curl抓取页面之前都比较稳定,后来就输出空页面了
-Yang
-Yang 2019-09-14 13:34:13
0
1
1134

http://live.500.com/2h1.php

这个是地址。构造过ip 来路 和浏览器标示头文件等,请问各位大佬这个要怎么才能抓取到这个网址

function curl_file_get_contents_nossl($durl){

$r = rand(80,255);

$useragent = array(

'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)',

'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2)',

'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',

'Mozilla/5.0 (Windows; U; Windows NT 5.2) Gecko/2008070208 Firefox/3.0.1',

'Opera/9.27 (Windows NT 5.2; U; zh-cn)',

'Opera/8.0 (Macintosh; PPC Mac OS X; U; en)',

'Mozilla/5.0 (Windows; U; Windows NT 5.2) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13 ',

'Mozilla/5.0 (Windows; U; Windows NT 5.2) AppleWebKit/525.13 (KHTML, like Gecko) Version/3.1 Safari/525.13'


);

$ch = curl_init();

curl_setopt($ch, CURLOPT_ACCEPT_ENCODING, "gzip,deflate");

curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:28.58.88.'.$r, 'CLIENT-IP:225.28.58.'.$r)); //构造IP

curl_setopt($ch, CURLOPT_URL, $durl);

curl_setopt($ch, CURLOPT_REFERER, "http://live.500.com/"); //构造来路

curl_setopt($ch, CURLOPT_TIMEOUT, 5);

curl_setopt($ch, CURLOPT_USERAGENT, array_rand($useragent));

//curl_setopt($ch, CURLOPT_REFERER,_REFERER_);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //不验证证书下同

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

$r = curl_exec($ch);

curl_close($ch);

return $r;

}


-Yang
-Yang

全部回复 (1)
-Yang

已经解决了,就是数据太多了,,,,

    最新下载
    更多>
    网站特效
    网站源码
    网站素材
    前端模板
    关于我们 免责声明 Sitemap
    PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!