PHP cURL - 获得302

时间:2015-10-25 13:35:11

标签: php curl bots

我试图通过PHP中的cURL获取网站内容。

但是一切,我回来的只是302指向主页,所以我认为,这是一种机器人保护。

有没有机会解决它?

代码:

$curl_handle = curl_init ("****");
curl_setopt ($curl_handle, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
curl_setopt ($curl_handle, CURLOPT_COOKIEFILE, dirname(__FILE__) . '/cookie.txt');
curl_setopt ($curl_handle, CURLOPT_COOKIEJAR, dirname(__FILE__) . '/cookie.txt');
curl_setopt ($curl_handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($curl_handle, CURLOPT_REFERER, "http://www.google.com/");
$output = curl_exec ($curl_handle);

0 个答案:

没有答案