You could use a PHP script like this:
pingdomain.php
PHP Code:
<?php
function pingDomain($domain){
$starttime = microtime(true);
$file = fsockopen ($domain, 80, $errno, $errstr, 10);
$stoptime = microtime(true);
$status = 0;
if (!$file) $status = -1; // Site is down
else {
fclose($file);
$status = ($stoptime - $starttime) * 1000;
$status = floor($status);
}
return $status;
}
echo pingDomain($_GET["domain"]);
?>
And then load it with xmlhttp:
pingdomain.php?domain=www.kirupa.com
and then check whether the responseText is 0 or -1