View Single Post
Old 09-01-2009, 02:40 PM   #3 (permalink)
gamer13
The Wanderer
 
gamer13's Avatar
 
Join Date: Sep 2009
Posts: 15
Thanks: 4
gamer13 is on a distinguished road
Default

Try this:

PHP Code:
<?php
$ch 
curl_init();

curl_setopt($chCURLOPT_URL"http://www.example.com/blog.php");
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);

$content curl_exec($ch);
if (
preg_match('/<div(.*?)>(.*?)<\/div>/is'$content$matches) {
    echo 
$matches[2];
} else {
    echo 
'Nothing found!';
}
So consider you have this page:
Code:
<html>
<head>
    <title>Some title</title>
</head>
<body>
    <div id="entry">Some random text</div>
</body>
</html>
Then the PHP script will output: "Some random text".
gamer13 is offline  
Reply With Quote