Home > Backend Development > PHP Tutorial > PHP uses CURL proxy problem

PHP uses CURL proxy problem

PHP中文网
Release: 2023-03-01 06:30:02
Original
4068 people have browsed it

socks5 - PHP uses CURL proxy problem

Use a socket5 proxy to access Google. It works in command line mode, but the PHP code does not work. It returns false directly
The code is posted, please help me solve it

PHP uses CURL proxy problem

PHP uses CURL proxy problemThe proxy string is written as tcp://127.0.0.1:1080Try it,

$ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        if ($this->proxy) {
            curl_setopt($ch, CURLOPT_PROXY, $this->proxy);
        }
Copy after login

The above is the configuration when I did Google, it works normally.

The above is the content of socks5 - PHP using CURL proxy problem. For more related content, please pay attention to the PHP Chinese website (m.sbmmt.com)!

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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template