标签:out span func nsf url pre tin curl head
public function gethttpcode($url){
$ch = curl_init ();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, 2);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_NOBODY, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, ‘GET‘);
curl_exec($ch);
$httpcode=intval(curl_getinfo($ch,CURLINFO_HTTP_CODE));
if($httpcode!=404){
return true;
}
return false;
}
标签:out span func nsf url pre tin curl head
原文地址:http://www.cnblogs.com/pcx105/p/7491071.html