I have a working function to get external website speed.
$t = microtime( TRUE );
file_get_contents( "http://www.example.org" );
$t = microtime( TRUE ) - $t;
print "It took $t seconds!";
However, if the external url is down, it prints this;
Warning: file_get_contents(http://www.example.org): failed to open stream: HTTP request failed!
HTTP/1.0 500 Internal Server Error in /home/china/public_html/dene.php on line 47
It took 14.4556088448 seconds!
What is the corerct way, to print "Site down", instead of getting that error ?