09-01-2009, 02:40 PM
|
#3 (permalink)
|
|
The Wanderer
Join Date: Sep 2009
Posts: 15
Thanks: 4
|
Try this:
PHP Code:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/blog.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$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".
|
|
|
|