Home > Backend Development > PHP Tutorial > PHP uses curl to implement the method of obtaining data through a proxy

PHP uses curl to implement the method of obtaining data through a proxy

墨辰丷
Release: 2023-03-29 13:38:02
Original
8314 people have browsed it

This article mainly introduces the implementation method of using curl to obtain data through proxy in php. It mainly involves the usage skills of CURLOPT_PROXYUSERPWD parameter in php curl. Friends in need can refer to it

The details are 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);
Copy after login

Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.

Related recommendations:

PHP implements multi-image upload and single-image upload functions

PHP mobile phone SMS verification code implementation process Detailed explanation

phpWeChat public platform development WeChat group messaging example sharing

The above is the detailed content of PHP uses curl to implement the method of obtaining data through a proxy. For more information, please follow other related articles on the PHP Chinese website!

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 Issues
curl simulated login
From 1970-01-01 08:00:00
0
0
0
Convert cURL command line to PHP cURL code
From 1970-01-01 08:00:00
0
0
0
Convert command line cURL to PHP cURL
From 1970-01-01 08:00:00
0
0
0
How to set boolean value true in php curl
From 1970-01-01 08:00:00
0
0
0
Please tell me, php curl request page shows blank
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template