I'm trying to download a csv that's been gz'd directly to a file:
$fp = fopen ($file.'.csv', 'w+');
$ch = curl_init($url.'/'.$file.'.csv.gz');
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
curl_exec($ch);
curl_close($ch);
fclose($fp);
What ends up happening is {$file}.csv is written to disk, however it's still encoded. If I rename the stored file {$file}.csv.gz and gunzip it the data is decoded properly.