简体   繁体   中英

php cURL return size increase

I'm Currently proxying an endpoint by running a cURL however the size of my cURL is about 10 times larger than the original API, Why is that, and how can I decrease the size? This is all JSON BTW.

Original API return size = 32.2kb cURL return size = 488KB

And here is my cURL script:

$ch = curl_init();
// set url
$url = 'http://domain.com/api/v1';

// set options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
curl_setopt($ch, CURLOPT_ENCODING,  '');
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);

// close curl resource to free up system resources
curl_close($ch);
return $output;

ob_start('ob_gzhandler'); php output buffer controll was the fix to my problem. Thanks all that tried to help!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM