function ping($host, $port = 80, $timeout = 5)
{
$fsock = fsockopen($host, $port, $errno, $errstr, $timeout);
if ( ! $fsock )
return FALSE;
else
return TRUE;
}
$host = 'www.collectivesolver.com';
if( ping($host) )
echo $host . " - is online<br>";
else
echo $host . " - is down<br>";
/*
run:
www.collectivesolver.com - is online
*/