您好,欢迎访问一九零五行业门户网

php使用curl获取https请求的方法_PHP教程

php使用curl获取https请求的方法 这篇文章主要介绍了php使用curl获取https请求的方法,涉及curl针对https请求的操作技巧,非常具有实用价值,需要的朋友可以参考下
本文实例讲述了php使用curl获取https请求的方法。分享给大家供大家参考。具体分析如下:
今日在做一个项目,需要curl获取第三方的api,对方的api是https方式的。
之前使用curl能获取http请求,但今天获取https请求时,出现了以下的错误提示:证书验证失败。
ssl certificate problem, verify that the ca cert is ok. details: error:14090086:ssl routines:ssl3_get_server_certificate:certificate verify failed
解决方法为在curl请求时,加入:
代码如下:
curl_setopt($ch, curlopt_ssl_verifypeer, false); // 跳过证书检查
curl_setopt($ch, curlopt_ssl_verifyhost, true); // 从证书中检查ssl加密算法是否存在 
curl https请求代码
代码如下:
'fdipzone');
$header = array();
$response = curl_https($url, $data, $header, 5);
echo $response;
?> 
希望本文所述对大家的php程序设计有所帮助。
http://www.bkjia.com/phpjc/956981.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/956981.htmltecharticlephp使用curl获取https请求的方法 这篇文章主要介绍了php使用curl获取https请求的方法,涉及curl针对https请求的操作技巧,非常具有实用价值,需要的...
其它类似信息

推荐信息