Home > php教程 > PHP源码 > https 认证失败解决过程

https 认证失败解决过程

PHP中文网
Release: 2016-05-25 17:10:11
Original
1998 people have browsed it

php curl ssl 认证错误 及其他常见错误 解决办法汇总: 

/**
 参考加 搜索 之后才发现 

参考地址:http://www.google.com.hk/search?hl=zh-CN&newwindow=1&safe=strict&client=firefox-a&hs=fyZ&rls=org.mozilla%3Azh-CN%3Aofficial&q=https+curl%E8%B0%83%E7%94%A8&btnG=Google+%E6%90%9C%E7%B4%A2

http://bbs.chinaunix.net/thread-3654216-1-1.html
*/

 php curl常见错误:SSL错误、bool(false)

症状:php curl调用https出错

排查方法:在命令行中使用curl调用试试。

原因:服务器所在机房无法验证SSL证书。

解决办法:跳过SSL证书检查。

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);



症状:php curl调用curl_exec返回bool(false),命令行curl调用正常。

排查方法:

var_dump(curl_error($ch));

返回:

string(23)"Empty reply from server"

再排查:

 curl_setopt($ch, CURLOPT_HEADER, true);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);

返回:

HTTP/1.1 100 Continue
Connection: close

原因:php curl接收到HTTP 100就结束了,应该继续接收HTTP 200

解决方案:

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
Copy after login


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template