在 Windows 7 中使用 Curl 获取 Https 网页
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3562095/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Using Curl to get a Https webpage in Windows 7
提问by VolatileRig
I just need to fetch an https page, and I'm using curl currently by having the curl.exe application in my Path and calling it with a Perl file. However, then I get the error "* Protocol https not supported or disabled in libcurl". I've been looking around and I can't find a solid set of instructions to get it to work. I have installed cygwin, and OpenSSL-Win32 but something tells me I'm going to have to compile curl from scratch. I have no experience with this. How do you do it?
我只需要获取一个 https 页面,我目前正在使用 curl,方法是在我的路径中放置 curl.exe 应用程序并使用 Perl 文件调用它。但是,然后我收到错误“* 在 libcurl 中不支持或禁用协议 https”。我一直在环顾四周,但找不到一套可靠的说明来使其正常工作。我已经安装了 cygwin 和 OpenSSL-Win32,但有些东西告诉我我将不得不从头开始编译 curl。我没有这方面的经验。你怎么做呢?
回答by Aravind Yarram
I found the below steps worked well
我发现以下步骤效果很好
- Download and unzip 64-bit cURL with SSL.
- Download the latest bundle of Certficate Authority Public Keysfrom mozilla.org.
- Rename this file from cacert.pem to curl-ca-bundle.crt
- Make sure both of them are in the
PATH
environment.
- 使用 SSL下载并解压缩 64 位cURL。
- 从 mozilla.org下载最新的证书颁发机构公钥包。
- 将此文件从 cacert.pem 重命名为 curl-ca-bundle.crt
- 确保它们都在
PATH
环境中。
Test
测试
curl -L https://www.google.com
UPDATE
更新
If you are open to try other tools, I think httpieis also a good alternative.
如果你愿意尝试其他工具,我认为httpie也是一个不错的选择。
回答by Aaron Saunders
curl --insecure
If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option.
如果您想关闭 curl 对证书的验证,请使用 -k(或 --insecure)选项。