癥狀:php curl調用curl_exe " /> 外国三级黄色片,在线成人小视频,澳门成人免费永久视频

一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

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:'));

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.

php技術php curl常見錯誤:SSL錯誤、bool(false),轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 国产欧美精品区一区二区三区 | 麻豆91视频| 精品72久久久久久久中文字幕 | 亚洲激情视频在线 | 色女生影院 | 亚洲美女在线视频 | 国产精品久久自在自2021 | 亚洲黄色在线网站 | 一级黄色网络 | 一区二区三区免费视频观看 | 涩涩在线视频 | 色噜噜狠狠一区二区三区 | 福利在线播放 | 在线五月婷婷 | 国产精品福利午夜在线观看 | 亚洲国产精品婷婷久久久久 | 手机日韩理论片在线播放 | 99久久精品免费精品国产 | 91精品国产免费久久久久久 | 99久久综合狠狠综合久久 | 特黄毛片 | 成人午夜免费福利视频 | 最新日本免费一区二区三区中文 | 亚洲天堂一区二区 | 亚洲产国偷v产偷v自拍涩爱 | 亚洲伊人久久大香线焦 | 四虎在线最新地址4hu | 国产一久久香蕉国产线看观看 | 男女午夜性爽快免费视频不卡 | 中文字幕二区三区 | 久久综合偷偷噜噜噜色 | 国产精品欧美激情第一页 | 欧美激情精品久久久久久大尺度 | 日产欧产va高清 | 91激情 | 99久久精品国内 | 伊人网久久网 | 精品一二三区 | 色视频www在线播放国产人成 | 91精品国产91久久久久久麻豆 | 四虎精品久久久久影院 |