首页 >php教程 >PHP源码 >php curl通过代理获取数据

php curl通过代理获取数据

大家讲道理
大家讲道理原创
2016-11-08 14:30:451237浏览

$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);

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn