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


一、命令行:


 curl -x IP:PORT -k 'https://SITE'

结果: 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);

结果:boolean(false)


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

ip curl https php 代理

vodevil 9 years, 3 months ago

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

哦噶米丶小红帽 answered 9 years, 3 months ago

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

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

niphor answered 9 years, 3 months ago

Your Answer