Bug #79097 [Opn->Ver]: when set CURLOPT_ENCODING "gzip", can't get raw data responsed

From: Date: Sat, 11 Jan 2020 14:15:27 +0000
Subject: Bug #79097 [Opn->Ver]: when set CURLOPT_ENCODING "gzip", can't get raw data responsed
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224843@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79097&edit=1 ID: 79097 Updated by: cmb@php.net Reported by: 839325966 at qq dot com Summary: when set CURLOPT_ENCODING "gzip", can't get raw data responsed -Status: Open +Status: Verified Type: Bug Package: cURL related Operating System: centos 7.7 PHP Version: 7.2.26 Block user comment: N Private report: N New Comment: You have to add curl_setopt($curl, CURLOPT_HTTP_CONTENT_DECODING, false); CURLOPT_HTTP_CONTENT_DECODING is available as of PHP 5.5.0 if built against libcurl >= 7.16.2. Since this is not documented, changing to doc bug. Previous Comments: ------------------------------------------------------------------------ [2020-01-11 03:16:22] 839325966 at qq dot com Description: ------------ when set CURLOPT_ENCODING "gzip", can't get raw data responsed. Test script: --------------- <?php $url = "https://bugs.php.net/report.php"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_TIMEOUT, 30); curl_setopt($curl, CURLOPT_ENCODING, 'gzip, deflate'); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); $responseBody = curl_exec($curl); $headerArray = curl_getinfo($curl); if (strlen($responseBody) != $headerArray['size_download']) { printf("error, response data length:%d, download size:%d\n", strlen($responseBody), $headerArray['size_download']); } Expected result: ---------------- reuse CURLOPT_BINARYTRANSFER suggest ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79097&edit=1

« previous php.bugs (#224843) next »