我有这个代理地址:125.119.175.48:8909
如何使用cURL(如cURL http://www.example.com)执行HTTP请求,但指定我的网络的代理地址?
我有这个代理地址:125.119.175.48:8909
如何使用cURL(如cURL http://www.example.com)执行HTTP请求,但指定我的网络的代理地址?
当前回答
根据您的工作场所,您可能还需要为curl指定-k或——insecure选项,以解决CA证书的潜在问题。
curl -x <myCompanyProxy>:<port> -k -O -L <link to file to download>
其他回答
根据您的工作场所,您可能还需要为curl指定-k或——insecure选项,以解决CA证书的潜在问题。
curl -x <myCompanyProxy>:<port> -k -O -L <link to file to download>
来自man curl:
-x, --proxy <[protocol://][user:password@]proxyhost[:port]>
Use the specified HTTP proxy.
If the port number is not specified, it is assumed at port 1080.
curl -I "https://www.google.com" -x 1.1.1.1:8080
注意,如果你正在使用SOCKS代理,而不是HTTP/HTTPS代理,你将需要使用——socks5开关:
curl --socks5 125.119.175.48:8909 http://example.com/
还可以使用——socks5-hostname代替——socks5在代理端解析DNS。
一般方法:
export http_proxy=http://your.proxy.server:port/
然后,您可以通过代理从(许多)应用程序连接。
而且,正如下面的评论,对于https:
export https_proxy=https://your.proxy.server:port/