成人在线亚洲_国产日韩视频一区二区三区_久久久国产精品_99国内精品久久久久久久

您的位置:首頁技術(shù)文章
文章詳情頁

curl抓取頁面之前都比較穩(wěn)定,后來就輸出空頁面了

瀏覽:122日期:2022-06-08 17:58:26

問題描述

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

這個(gè)是地址。構(gòu)造過ip 來路 和瀏覽器標(biāo)示頭文件等,請(qǐng)問各位大佬這個(gè)要怎么才能抓取到這個(gè)網(wǎng)址

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)); //構(gòu)造IP

curl_setopt($ch, CURLOPT_URL, $durl);

curl_setopt($ch, CURLOPT_REFERER, "http://live.500.com/"); //構(gòu)造來路

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); //不驗(yàn)證證書下同

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

$r = curl_exec($ch);

curl_close($ch);

return $r;

}

問題解答

回答1:

已經(jīng)解決了,就是數(shù)據(jù)太多了,,,,