PHP ~ get status code by curl

use this function should open extension php_curl first~ in php.ini

extension=php_curl.dll


function getUrlStatusCode($url)
{
 $ch = curl_init($url); 
 curl_setopt($ch, CURLOPT_NOBODY, true); 
 curl_exec($ch); 
 $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); 
 curl_close($ch); 
 return $status_code;
}

reference
http://www.webmasterworld.com/php/3311744.htm

沒有留言: