Halt error on fsockopen()

software development


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?

[quote][code]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 “Offline\n”;
} else {
echo “Online\n”;


I think you can just stick in a @ in front of the function

Rails Hosting - DH supports Ruby on Rails!
[color=#CC0000]Tip - use the DreamHost promo code X50 to get $50 off any of their plans instantly[/color]


Thanks for the idea on this one. Trying it out, just waiting for the servers to go down next and see if it works.