Halt error on fsockopen()
Posted by: psychichigh
Posted on: 2006-03-03 12:57:00
I got a script going to show the server status of some game servers to show if they're online or offline. But when a server is offline it also prints out the error message that fsockopen couldn't connect.
Is there a way to halt the error message from showing up?
In reply to:while (list($servname, $servip) = each($servers)) {
if ($servname == 'Login Server') {
$servport = '15100';
} else {
$servport = '15001';
}
echo "$servname ";
$fp = fsockopen($servip, $servport, $errno, $error, 10);
if (!$fp) {
echo "<font color=#ff0000>Offline</font>n";
} else {
echo "<font color=#00ff00>Online</font>n";
fclose($fp);
}
}