【问题标题】:PHP Curl proxy wrong portPHP Curl代理错误的端口
【发布时间】:2014-08-21 11:43:07
【问题描述】:

我有这个代码:

(...) //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 端口?

【问题讨论】:

    标签: php curl proxy


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2012-06-24
      • 2023-03-13
      • 1970-01-01
      • 2017-02-08
      • 2018-04-12
      • 1970-01-01
      • 1970-01-01
      • 2011-09-11
      • 1970-01-01
      相关资源
      最近更新 更多