curl_getinfo return good while curl_exec return false

For not once, I encounter this problem: curl_exec returns false but curl_getinfo returns a valid object. I even see the http_code=200 and header_size is a good number. Why curl_exec always returns false? Using curl_error($curl) and curl_errno($curl), I find the error # is 56 and the error message is “Problem (2) in the Chunked-Encoded data”. This is a problem caused by curl option. Add the code:curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); and the problem is solved.

Posted in

Comments are closed, but trackbacks and pingbacks are open.