Google搜索拒绝访问

时间:2015-03-26 13:15:14

标签: php curl proxy

我有点问题。

有时我在搜索随机关键字时会收到错误“拒绝访问”。

看起来像这样:enter image description here

这是代码

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $Url);

curl_setopt($ch, CURLOPT_HEADER, 0); // no headers in the output
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // output to variable
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0");
curl_setopt($ch, CURLOPT_PROXYPORT, $port);
curl_setopt($ch, CURLOPT_PROXYTYPE, 'HTTP');
curl_setopt($ch, CURLOPT_PROXY, $ip);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $loginpassw);

// Download the given URL, and return output
$output = curl_exec($ch);

// Close the cURL resource, and free system resources
curl_close($ch);

0 个答案:

没有答案