Code Snippets Php

$url = fsockopen("www.google.com", 80, &$errno, &$errstr, 30);
if(!$url) {
//site is down
echo "Google is down!!\n"; }
//site is up
else
{
echo("Google");
}
?>