Home > Backend Development > PHP Tutorial > 跪求PHP 大神解救有关问题!卡了一个礼拜了!curl代理请求有关问题

跪求PHP 大神解救有关问题!卡了一个礼拜了!curl代理请求有关问题

WBOY
Release: 2016-06-13 12:03:47
Original
1036 people have browsed it

跪求PHP 大神解救问题!卡了一个礼拜了!curl代理请求问题!
$ch = curl_init();
curl_setopt ($ch, CURLOPT_PROXY,'218.66.66.18:80');
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
curl_setopt ($ch, CURLOPT_URL, 'http://www.baidu.com');
curl_setopt ($ch, CURLOPT_TIMEOUT, 120); 
curl_setopt ($ch, CURLOPT_AUTOREFERER,1);
curl_setopt ($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
dump($result);
//我去掉端口代理就可以访问到百度,加了代理端口为什么不行!是什么方式不对么?这个端口可以用吧!求大神详细解答感谢!
------解决方案--------------------
218.66.66.18:80 是 新华都商学院本科招生网
并不是什么代理服务器,所以 CURLOPT_HTTPPROXYTUNNEL 就无法建立通道

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template