復(fù)制代碼 代碼如下:
$curlPost = 'a=1&b=2';//模擬POST數(shù)據(jù)
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:0.0.0.0', 'CLIENT-IP:0.0.0.0')); //構(gòu)造IP
curl_setopt($ch, CURLOPT_REFERER, "http://www.survivalescaperooms.com/"); //構(gòu)造來路
curl_setopt($ch,CURLOPT_URL, 'http://www.survivalescaperooms.com');//需要抓取的頁面路徑
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);//post值
$file_contents = curl_exec($ch);//抓取的內(nèi)容放在變量中
curl_close($ch)
新聞熱點
疑難解答