function ping($host, $port, $timeout) { $tB = microtime(true); $fP = fSockOpen($host, $port, $errno, $errstr, $timeout); if (!$fP) { return "N/A"; } $tA = microtime(true); return round((($tA - $tB) * 1000), 0); } $remotehost = "www.google.com"; $pingresult = ping($remotehost, 80, 2); if ($pingresult == "N/A") { $stat1 = "N/A (".$remotehost.")"; } else { $stat1 = "".$pingresult."ms (".$remotehost.")"; } ?>
Internet: Print $stat1 ?>