Forum Moderators: coopster
i tried [webmasterworld.com ] but it didn't work
Use something like:
$handle = fopen ("http://www.yourdomainname.biz/file.html", "r");
do {
$data = fread($handle, 8192);
if (strlen($data) == 0) {
break;
}
$contents .= $data;
} while(true);
fclose ($handle);
if(ereg("<!-- begin content -->(.*)<!-- end content -->", $contents, $out)){
echo $out[1];
}
else {
echo "No Match";
}
// Change these variables to suit
$pathtocurl = "curl";
$pageyouwanttograb = "http://www.yahoo.com";
$filetowriteto = "writetothisfile.txt";exec("$pathtocurl $pageyouwanttograb",$page);
if(!count($page))
{
echo 'couldnt get page';
exit;
}
$page = preg_split("'<body[^>]+>'ims",implode("",$page));
$page = $page[1];
$fp = fopen($filetowriteto,"w");
fwrite($fp,$page);
fclose($fp);
It will output "couldnt get page" if you have the wrong path to curl or the url you requested couldnt be reached.