当前位置:Gxlcms > PHP教程 > phpcurl代理问题

phpcurl代理问题

时间:2021-07-01 10:21:17 帮助过:17人阅读

        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] =>
)

代理是shadowsocks
浏览器用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] =>
)

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

必须是 CURLPROXY_SOCKS5

人气教程排行