如何禁用cURL SSL证书验证

如何禁用cURL SSL证书验证,ssl,curl,ssl-certificate,Ssl,Curl,Ssl Certificate,您好,我想为网站使用API,但我的curl命令出错 我想禁用SSL证书验证 curl: (60) SSL certificate problem: self signed certificate in certificate chain More details here: https://curl.haxx.se/docs/sslcerts.html curl failed to verify the legitimacy of the server and therefore could

您好,我想为网站使用API,但我的curl命令出错

我想禁用SSL证书验证

curl: (60) SSL certificate problem: self signed certificate in certificate chain
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.

只需将
-k
开关添加到url之前的某个位置

免责声明:使用本产品的风险自负

man curl | less +/--insecure
-k、 ——不安全 (TLS)默认情况下,curl建立的每个SSL连接都被验证为安全的。此选项允许curl继续操作 即使是服务器连接,否则被认为是不安全的

通过确保服务器的证书包含正确的名称并成功验证,可以验证服务器连接 使用证书存储

有关更多详细信息,请参阅此联机资源:

另请参见--proxy unsecure和--cacert


简单的谷歌搜索“curl disable ssl”-->--不安全您应该显示您的代码。如前所述,这只是一个关于如何运行命令的问题。根据您的代码,社区可能能够建议如何为连接使用适当的CA,而不是完全禁用它。你的策略还有很多不足之处。另见。