webhost
01-26-2002, 09:42 PM
Hi,
i`m using some php code to get servers` uptime, and here is it:
$fp = @fsockopen("12.34.56.78", "80", &$errno, &$errstr, 2);
if ($fp){
$ufuptimex=@fopen("http://12.34.56.78/get.php","r");
socket_set_timeout($ufuptimex, 2);
$ufuptime = @fgets($ufuptimex, 100);
$ufuptime = '<font color=green><b>'.$ufuptime."</b></font>";
} else {
$ufuptime = '<font color=red><b>Server out of service</b></font>';
}
@fclose($fp);
and here is my problem, if apache goes down no remote server port 80 is still opened for a default timeout (about 5 mins)..... script tryes to get uptime info and page doesnt load..... is there anyway to set fopen timeout?
i`m using some php code to get servers` uptime, and here is it:
$fp = @fsockopen("12.34.56.78", "80", &$errno, &$errstr, 2);
if ($fp){
$ufuptimex=@fopen("http://12.34.56.78/get.php","r");
socket_set_timeout($ufuptimex, 2);
$ufuptime = @fgets($ufuptimex, 100);
$ufuptime = '<font color=green><b>'.$ufuptime."</b></font>";
} else {
$ufuptime = '<font color=red><b>Server out of service</b></font>';
}
@fclose($fp);
and here is my problem, if apache goes down no remote server port 80 is still opened for a default timeout (about 5 mins)..... script tryes to get uptime info and page doesnt load..... is there anyway to set fopen timeout?