function baiduzz($url){
$ch = curl_init();
//随机生成IP
$ips=array('220.181.7','123.125.66','220.181.68','123.125.68','123.125.71');
$ip = $ips[rand(0,3)].'.'.rand(0,255) ; // 百度 蜘蛛
$timeout = 30;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_TIMEOUT,0);
//伪造百度 蜘蛛IP
curl_setopt($ch,CURLOPT_HTTPHEADER,array('X-FORWARDED-FOR:'.$ip.'','CLIENT-IP:'.$ip.''));
//伪造百度 蜘蛛头部
curl_setopt($ch,CURLOPT_USERAGENT,"Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)");
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$content = curl_exec($ch);
curl_close($ch);
return $content;
}
《本文》有 0 条评论