curl请求https报错

curl 一般情况下请求http时不会有问题

但是请求 https 协议的链接时会报错,如下:

curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html
 
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

 

解决办法:

1、到 curl 的官网上去下载一个包含很多“权威第三方”信息的证书

      https://curl.haxx.se/ca/cacert.pem

2、将下载的 cacert.pem 证书放到 curl.exe 同级目录下

3、访问命令

curl -v --cacert cacert.pem https://www.baidu.com

 

参考链接:

【Linux学习笔记】探讨curl无法访问https网站的问题_shangke_sks的博客-CSDN博客_curl 无法访问https

posted @ 2022-03-30 12:01  散人长情  阅读(1131)  评论(0编辑  收藏  举报