- 时间:2021-02-15 01:27 编辑: 来源: 阅读:
- 扫一扫,手机访问
摘要:php curl 获取https请求的2种方法
今天一个同事反映,使用curl发起https请求的时候报错:“SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed”
很明显,验证证书的时候出现了问题。
使用curl如果想发起的https请求正常的话有2种做法:
[b]方法一、设定为不验证证书和host。[/b]
在执行curl_exec()之前。设置option
[url=http://curl.haxx.se/ca/cacert.pem]http://curl.haxx.se/ca/cacert.pem[/url]
放到 程序文件目录
curl 增加下面的配置
[url=http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/]http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/[/url]
微信版

扫一扫进微信版
返回顶部