Home > Backend Development > PHP Tutorial > curl如何通过代理IP请求https网址

curl如何通过代理IP请求https网址

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:27:01
Original
5233 people have browsed it

一、命令行:

<code>curl -x IP:PORT -k 'https://SITE'</code>
Copy after login
Copy after login

结果: curl: (56) Proxy CONNECT aborted

二、PHP代码

$ip = "IP:PORT";
$url = "https://SITE";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_PROXY, $ip);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
var_dump($output);
Copy after login
Copy after login

结果:boolean(false)


RT,这个问题让我好头疼,网站没搜到资料,求问有什么方式可以实现我的需求吗?

回复内容:

一、命令行:

<code>curl -x IP:PORT -k 'https://SITE'</code>
Copy after login
Copy after login

结果: curl: (56) Proxy CONNECT aborted

二、PHP代码

$ip = "IP:PORT";
$url = "https://SITE";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_PROXY, $ip);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
var_dump($output);
Copy after login
Copy after login

结果:boolean(false)


RT,这个问题让我好头疼,网站没搜到资料,求问有什么方式可以实现我的需求吗?

参考 so 上这两篇文章提供的方法

curl-https-through-a-proxy
linux-curl-command-with-proxy

装个proxychains,如果是见不得光的,可以用ss+arm-tor

Related labels:
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