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

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

WBOY
Release: 2016-06-23 13:41:05
Original
968 people have browsed it

作者:zhanhailiang 日期:2015-01-23
Copy after login

本地环境:

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

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

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

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

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

curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
Copy after login

即可修复该问题。

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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template