$result = fsockopen("www.example.com", 80, $errno, $errstr, 5); if(! $result) { echo $errno . ' : ' . $errstr; }