Using fopen() to retrieve data sometimes prevents the page from loading when the other site is not responding.
How can I tell the below to exit after a few seconds of attempting without success and to echo "unable to connect"?
thank you.
<?
$fd= fread(fopen("http://site.com/index.html", "r"), 100000);
if ($fd)
{
$start= strpos($fd, "start point");
$finish= strpos($fd, "endpoint);
$length= $finish-$start;
$code_real=Substr($fd, $start, $length);
}
echo "$code_real";
?>