Home > php教程 > PHP源码 > php curl gets data through proxy

php curl gets data through proxy

大家讲道理
Release: 2016-11-08 14:30:45
Original
1250 people have browsed it

$curl=curl_init();
            curl_setopt($curl, CURLOPT_URL, "http://www.baidu.com/");
            curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:20.0) Gecko/20100101 Firefox/20.0');
            curl_setopt($curl, CURLOPT_REFERER, 'http://www.guahao.com/');
            curl_setopt($curl, CURLOPT_POST, true);
            curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($param));
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, true);
            curl_setopt($curl, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);
            curl_setopt($curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
            curl_setopt($curl, CURLOPT_PROXY, "180.186.11.121");
            curl_setopt($curl, CURLOPT_PROXYPORT, "37211");
            curl_setopt($curl, CURLOPT_PROXYUSERPWD, "taras:taras-ss5");
             
            $result=curl_exec($curl);
Copy after login

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