1. <?php 
  2. ini_set('display_errors','1'); 
  3. ini_set('display_startup_errors','1'); 
  4. //error_reporting(E_ALL); 
  5. error_reporting(E_ALL ^ E_NOTICE); 
  6. set_time_limit(60); 
  7. mb_internal_encoding("UTF-8"); 
  8. mb_regex_encoding("UTF-8"); 
  9. date_default_timezone_set('PRC'); 
  10.  
  11. $curlHandle = curl_init(); 
  12. curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER,true); 
  13. curl_setopt($curlHandle, CURLOPT_TIMEOUT, 20); 
  14. curl_setopt($curlHandle, CURLOPT_URL, 'http://www.163.com'); 
  15. curl_setopt($curlHandle, CURLOPT_HEADER, 1); 
  16. $strRet = curl_exec($curlHandle); 
  17. if ($strRet === false) {    /* 失败或超时 */ 
  18.     die('false'); 
  19. else { 
  20.     $status = curl_getinfo($curlHandle, CURLINFO_HTTP_CODE); 
  21. curl_close($curlHandle); 
  22. echo $status
  23. ?>