This article describes the implementation method of using curl to obtain data through proxy. Share it for your reference, as follows:
$curl=curl_init(); curl_setopt($curl, CURLOPT_URL, "/"); 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, '/'); 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:Here, the editor recommends a php formatting and beautification typeface tool on this site to help everyone type in code in future PHP programming:
PHP code online formatting and beautification tool:http://tools./code/phpformat
For more information about PHP related content, please check out the topic of this site:Summary of the usage of php curl》、《Complete collection of PHP array (Array) operation techniques》、《Summary of php sorting algorithm》、《Summary of common traversal algorithms and techniques for PHP》、《PHP data structure and algorithm tutorial》、《Summary of PHP Programming Algorithm》、《Summary of PHP mathematical operation skills》、《Summary of usage of php regular expressions》、《Summary of PHP operations and operator usage》、《Summary of usage of php strings"and"Summary of common database operation techniques for php》
I hope this article will be helpful to everyone's PHP programming.