you need to adopt this if you change the protocol!! // (0x15 -> 21 is the object type id of EM_NET_STATUS_REQUEST) $statusrequest="45 4d 5f 4d 50 01 00 00 00 00 01 00 00 00 01 00 00 00 15 00 00 00"; $statusrequest = str_replace(' ', '', $statusrequest); $statusrequest = pack('H*', $statusrequest); $handle = fsockopen("udp://".$an_ip, $a_port, &$errno, &$errstr, 2); if (!$handle) { echo "$errno : $errstr
"; } else { socket_set_timeout ($handle, 2); $write = fwrite($handle,$statusrequest); if (!$write) { echo "error writing to socket
"; } else { $start = (float) array_sum(explode(' ', microtime())); $data = fread($handle, 1000); $end = (float) array_sum(explode(' ', microtime())); $delta = $end - $start; //compute the 'ping' fclose($handle); if ($delta < 1.9) { $result->data = $data; $result->ping = (int)($delta*1000); } else { $result->data = ""; $result->ping = ">2000"; } return $result; } } } /* the output code */ if(isset($_REQUEST["ip"])) $ip = $_REQUEST["ip"]; else $ip=""; if(isset($_REQUEST["port"])) $port = $_REQUEST["port"]; else $port=0; if(!($port + 0 <= 0) and !($ip=="")) { $answer = contactServer($ip,$port); echo "\n"; if ($answer->data) { $a = explode('?',$answer->data); $data = $a[1]; $a = explode('&', $data); $i = 0; echo "\n"; while ($i < count($a)) { $b = split('=', $a[$i]); echo '\n"; $i++; } } else { echo "\n"; } echo "
Server status for $ip:$portping: $answer->ping ms
', htmlspecialchars(urldecode($b[0])),'', htmlspecialchars(urldecode($b[1])), "
Server $ip:$port timed outping: $answer->ping ms
\n"; } else { echo "error: malformed IP:PORT
\n"; } ?>