Does anyone know how to uncompress the contents of a gzip file that i got with curl?
for example: http://torcache.com/torrent/63ABC1435AA5CD48DCD866C6F7D5E8076603439
You can do it with gzinflate (pretending that $headers contains all your HTTP headers, and $buffer contains your data):
if (isset($headers['Content-Encoding']) && ($headers['Content-Encoding'] === 'gzip' || $headers['Content-Encoding'] === 'deflate'))
{
if ($headers['Content-Encoding'] === 'gzip')
{
$buffer = substr($buffer, 10);
}
$contents = @gzinflate($buffer);
if ($contents === false)
{
return false;
}
}