Example: /PortPing.php?host=google.com&port=80");
}
$t =(isset($_GET["t"]))?$_GET["t"]:4; // default 4 pings.
$ip = gethostbyname($host);
if (isset($_GET["source"])) {
die ( ping($host, $port) );
}
function ping($host, $port) {
$startTime = time();
if ($fs = fsockopen($host, $port, $errCode, $errStr, 1)) {
$timeTaken = (time()-$startTime)/1000;
echo "Reply from $host:$port time={$timeTaken}ms";
fclose($fs);
} else {
echo "Request timed out.";
}
echo "
";
}
?>
Trying to connect :