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

https 认证失败解决过程

May 25, 2016 pm 05:10 PM

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


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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)