ID: 22967 Updated by: [EMAIL PROTECTED] Reported By: atz at atz dot msk dot ru Status: Open -Bug Type: Zlib Related +Bug Type: Feature/Change Request Operating System: FreeBSD 5.0-RELEASE PHP Version: 4CVS-2003-03-30 (stable) New Comment:
the gzuncompress() function expects to decompress the header-less data generated by gzcompress(). The workaround is to write to a temp file and read it in, or you could just cut-off the gzip header and try gzuncompress. (the header is usually 10 bytes in length, so gzuncompress(substr($Data,10)) might work). It looks like you need the opposite of gzencode(), which can will correctly deal with this. Previous Comments: ------------------------------------------------------------------------ [2003-03-30 14:57:44] atz at atz dot msk dot ru I'am trying to fetch data with fsockopen and etc. from URL http://suncity.combats.ru/inf.pl?login=atz OR http://capitalcity.combats.ru/inf.pl?login=atz And as result in variable named $Data i have a compressed gzip data from that url with "Content-encoding: gzip". But! When i try to gzuncompress($Data) the php returns Warning: gzuncompress(): data error gzinflate($Data) Warning: gzinflate(): data error I'm try to do following: $fp = fopen("gzipped","w"); fwrite($fp, $Data, strlen($Data)); fclose($fp); $buffer = ""; $gzfp = gzopen("gzipped","r"); while (!gzeof($gzfp)) { $buffer .= gzread($gzfp, 1024); } gzclose($gzfp); And as result i have normal UNCOMPRESSED data in varaiable named $buffer. Why gzuncompress do not uncompress $Data while gzopen do this success? Is this a bug? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22967&edit=1