05-26-2010, 06:58 AM
I'm trying to intergrate this as part of a php web panel, and want to display the current status of the server (online/offline/updating). I'm trying to combine this with a server status script I found, but it returns the status as online even if the server isn't responding
I think I'm missing something really simple, but it displays the first argument even if the server isn't responding...any ideas?
PHP Code:
if ($sock = @fsockopen($_ip, $_port, $num, $error, 5))
{
echo "".$q['name']."<br/>";
echo "$_ip:$_port";
echo '<b><FONT COLOR=lime>Online</b></FONT><br>';
echo "Map: ".$q['map']."<br/>";
echo "Players: ".$q['players']."";
echo "/";
echo "".$q['max']."<br/>";
}else{
echo "$_ip:$_port<br>";
echo "<FONT COLOR='RED'>Server Offline</FONT><br>";
}
I think I'm missing something really simple, but it displays the first argument even if the server isn't responding...any ideas?