$opts = array('http' =>

array(

'method'  => 'GET',

'timeout' => 3

)

);

$context  = stream_context_create($opts);

$url = "www.google.com";

$text = @file_get_contents($url,false,$context,-1,100);

if($text==FALSE){

 return FALSE;

}

return TRUE;