使用 curl 发送 https 请求时,如下命令就会报错:
1 | curl "https://www.baidu.com" |
错误代码:
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html
一般的解决办法就是下载CA证书。但是使用C++代码调用 libcurl
发送 https 请求,只需要在设置一下这个就可以关闭 ssl 验证,从而能够发送 https 请求。
1 | curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false); |