php卷曲返回大小增加
我目前正在通过运行cURL代理端点,但是我的cURL的大小大约是原始API的10倍,这是为什么,我如何减小大小?这都是JSON BTWphp卷曲返回大小增加,php,curl,Php,Curl,我目前正在通过运行cURL代理端点,但是我的cURL的大小大约是原始API的10倍,这是为什么,我如何减小大小?这都是JSON BTW 原始API返回大小=32.2kb cURL return size=488KB 这是我的卷曲脚本: $ch = curl_init(); // set url $url = 'http://domain.com/api/v1'; // set options curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($c
原始API返回大小=32.2kb
cURL return size=488KB
这是我的卷曲脚本:
$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输出缓冲区控件是解决我问题的方法。谢谢你的帮助 嗯,我想知道<代码>curl_setopt($ch,CURLOPT_编码,“gzip”)我不清楚你在问什么。那没用。我想,当你用一个空字符串设置它时,它会像一个通配符一样,只应用all?@AlbertoVillacortacurl_setopt($ch,CURLOPT_ENCODING,“gzip”)
可以在3/4的时间内减少下载量(刚刚测试过)。请对试图帮助你的人温和一点。@pedrobito原始api返回值是32.2kb,当我卷曲它时,返回值是488kb。我的问题是为什么它会这么大?如何减小大小以反映真实api返回的大小?我没有向它添加任何数据。