function checkServer($address, $port, $id, $timeout=5)
{
$fp=fsockopen("udp://$address", $port, $errno, $errstr, $timeout);
stream_set_timeout($fp, $timeout);
fwrite($fp, "\xFF\xFF\xFF\xFFTSource Engine Query".chr(0));
$state=(!fread($fp, 5))?"off":"on";
@fclose($fp);
return $state;
}
echo "Serverul war3.freakz.ro este: ".checkServer("war3.freakz.ro", 27015);
Mini-chat
Statistica
Forma intrarii