Home >Backend Development >PHP Tutorial >PHP curl报错“Problem (2) in the Chunked-Encoded data”解决方案

PHP curl报错“Problem (2) in the Chunked-Encoded data”解决方案

WBOY
WBOYOriginal
2016-06-23 13:41:05970browse

作者:zhanhailiang 日期:2015-01-23

本地环境:

系统版本:Microsoft Windows 6.1.7601PHP版本:PHP 5.3.29php_curl.dll扩展版本:7.35.0

Windows环境下遇到一个很奇怪的问题,使用PHP curl发送请求报错:

错误码:56错误信息:Problem (2) in the Chunked-Encoded data

但是使用浏览器直接访问又正常,怀疑是php_curl.dll扩展本身的bug,解决方案如下:

在PHP curl头部添加HTTP版本信息即可解决:

curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);

即可修复该问题。

Statement:
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