I want to do a check for game servers if they are online or not.
I tried using this method but it gives me false-positive:
if(! $sock = @fsockopen("udp://".$ip, $port, $errno, $errstr, 5))
{
//offline
}
else
{
//online
fclose($sock);
}
I tried to enter random IP addresses and even to open some game server and close it and it always doesn't return that the server is online (unless i enter IP like 255.255.255.255)
There is any other method to check server status? (mainly offline/online)