This article is an example of how PHP uses curl to get data through proxies. Share to everyone for your reference, specific as follows:
$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);
PS: Small knitting here recommend a site for the layout of the PHP format landscaping tools to help you in the future of PHP programming code layout:
PHP Code online Format Landscaping tool:Http://tools.jb51.net/code/phpformat
More about PHP Interested readers can view the site topics: "Php Curl Usage Summary", "PHP array" operation Skills Daquan, "PHP Sorting algorithm Summary", "PHP common traversal algorithm and skills summary", "PHP Data structure and algorithm tutorial", " PHP Programming algorithm Summary, "PHP Mathematical Calculation Skills Summary", "PHP Regular Expression Usage summary", "PHP operation and operator Usage Summary", "PHP string (String) Usage summary" and "PHP common database Operation skill Summary"
I hope this article will help you with the PHP program design.