• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

phpcurl常见错误:SSL错误、bool(false)

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
在命令行中使用curl调用跳过SSL证书检查的方法,需要的朋友可以参考下。
 
 
再排查: 
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:')); 

PHP and cURL: Disabling 100-continue header 
Published June 15th, 2006 
I've been using cURL (through PHP) to build a sort of proxy for a project I'm working on. I need to parse the returned headers (to recover the HTTP status), so had included a very simple script to do so. It had worked fine in the past, but for some reason barfed in this case. A closer look at what was being returned revealed that for some reason, Apache was prepending the ‘normal' headers with an extra response header: 

HTTP/1.1 100 Continue 

HTTP/1.1 200 OK Date: Fri, 09 Jun 2006 15:23:42 GMT 
Server: Apache 
...A bit of Googling revealed that this was to do with a header that cURL sends by default: 

Expect: 100-continue 

…which in turns tells Apache to send the extra header. I poked around a fair bit but couldn't quite find a workable solution short of manually removing the header in PHP, which seemed a bit clumsy. Finally, on a hunch I tried this: 

curl_setopt( $curl_handle, CURLOPT_HTTPHEADER, array( 'Expect:' ) ); 

…which basically overrides the original ‘Expect:' header with an empty one. 

Hope this helps someone.

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP.ini中的session相关设置发布时间:2022-07-10
下一篇:
Wiki安装(PHP +Sqlite+Cache)发布时间:2022-07-10
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap