I have function that open page on remote server, get the source, then make sumcheck of the page and compare it with the data in database to see, if the page was changed. So, the script looks working, but get timeout after 30 seconds on server. I have to check about 100 pages.
$fp = fsockopen ($domain, 80);
if(!$fp) {
echo $i." Unable to open\n".$url[$i]."<br>";
} else {
fputs($fp,"GET $url[$i] HTTP/1.0\n\n");
$start = time();
socket_set_timeout($fp, 2);
$content = fread($fp, 2000);
FClose ($fp);}
$getcrc = crc32 ("$contents");
if ($getcrc < 0) {$crc2=$getcrc*(-1);}
else{$crc2=$getcrc;}
if ($crc2=$crc[$i]){
$result=mysql_query("update page set ok='1' where crc=$crc[$i]");}
else {
$result=mysql_query("update page set ok='0' where crc=$crc[$i]");
}