PHP Curl代理错误的端口

时间:2014-08-21 11:43:07

标签: php curl proxy

我有这段代码:

(...) //other options...
curl_setopt($this->curl, CURLOPT_HTTPPROXYTUNNEL, true);
curl_setopt($this->curl, CURLOPT_PROXY, "xxx.xxx.xx.xx");
curl_setopt($this->curl, CURLOPT_PROXYPORT, 17600);
curl_setopt($this->curl, CURLOPT_URL, "http://www.randomDomain.com");
curl_setopt($this->curl, CURLOPT_PORT, 80);

$data = curl_exec($this->curl);
var_dump(curl_error($this->curl)); 
//result is: "Failed connect to www.randomDomain.com:17600; Connection refused"

curl错误告诉我尝试在17600端口上连接randomDomain - 来自代理......

为什么这不是80端口?

1 个答案:

答案 0 :(得分:0)

检查代理的访问权限并添加此选项以获取对$ data的响应

curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);