欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php curl 代理问题

程序员文章站 2023-12-27 13:21:15
...
        curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, false);
        curl_setopt($ch, CURLOPT_PROXYTYPE, $this->proxy['type']);
        curl_setopt($ch, CURLOPT_PROXY, $this->proxy['host']);
        curl_setopt($ch, CURLOPT_PROXYPORT, $this->proxy['port']);
        print_r($this->proxy);

Array
(
[host] => 127.0.0.1
[port] => 1080
[type] => 5
[user] =>
[pass] =>
)

代理是*
浏览器用ss代理访问url 没问题
我php curl 通过代理访问
couldn't connect to host

回复内容:

        curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, false);
        curl_setopt($ch, CURLOPT_PROXYTYPE, $this->proxy['type']);
        curl_setopt($ch, CURLOPT_PROXY, $this->proxy['host']);
        curl_setopt($ch, CURLOPT_PROXYPORT, $this->proxy['port']);
        print_r($this->proxy);

Array
(
[host] => 127.0.0.1
[port] => 1080
[type] => 5
[user] =>
[pass] =>
)

代理是*
浏览器用ss代理访问url 没问题
我php curl 通过代理访问
couldn't connect to host

必须是 CURLPROXY_SOCKS5

相关标签: curl php

上一篇:

下一篇: