I'm trying to get a script to timeout if the server is under heavy load or
otherwise unavailable. Eventually, this will try different mirrored domains
as each one times out. But at the moment I can't even get a single domain to
timeout:
$fp = fsockopen("www. example.com", 80, $errno, $errstr, 2);
if(!$fp) {
echo "Unable to open\n";
} else {
fputs($fp, "GET / HTTP/1.0\n\n");
$start = time();
socket_set_time out($fp, 2);
$res = fread($fp, 20000);
var_dump(stream _get_meta_data( $fp));
fclose($fp);
print $res;
}
Is there an override setting in the PHP ini file or something wrong in the
code above?
Thanks in advance
otherwise unavailable. Eventually, this will try different mirrored domains
as each one times out. But at the moment I can't even get a single domain to
timeout:
$fp = fsockopen("www. example.com", 80, $errno, $errstr, 2);
if(!$fp) {
echo "Unable to open\n";
} else {
fputs($fp, "GET / HTTP/1.0\n\n");
$start = time();
socket_set_time out($fp, 2);
$res = fread($fp, 20000);
var_dump(stream _get_meta_data( $fp));
fclose($fp);
print $res;
}
Is there an override setting in the PHP ini file or something wrong in the
code above?
Thanks in advance
Comment