Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : Zlib Compression Functions : gzinflate

gzinflate

Inflate a deflated string (PHP 4 >= 4.0.4, PHP 5)
string gzinflate ( string data [, int length] )

Example 2729. gzinflate() example

<?php
$compressed  
= gzdeflate('Compress me', 9);
$uncompressed = gzinflate($compressed);
echo
$uncompressed;
?>

Code Examples / Notes » gzinflate

boris

When retrieving mod_gzip'ed content and using gzinflate() to decode the data, be sure to strip the first 10 chars from the retrieved content.
$dec = gzinflate(substr($enc,10));


spikeles_

This can be used to inflate streams compressed by the Java class java.util.zip.Deflater but you must strip the first 2 bytes off it. ( much like the above comment )
$result = gzinflate(substr($compressedData, 2))


patatraboum

Some gz string strip header and return inflated
It actualy processes some first member of the gz
See rfc1952 at http://www.faqs.org/rfcs/rfc1952.html for more details and improvment as gzdecode
<?
function gzBody($gzData){
if(substr($gzData,0,3)=="\x1f\x8b\x08"){
$i=10;
$flg=ord(substr($gzData,3,1));
if($flg>0){
if($flg&4){
list($xlen)=unpack('v',substr($gzData,$i,2));
$i=$i+2+$xlen;
}
if($flg&8) $i=strpos($gzData,"\0",$i)+1;
if($flg&16) $i=strpos($gzData,"\0",$i)+1;
if($flg&2) $i=$i+2;
}
return gzinflate(substr($gzData,$i,-8));
}
else return false;
}
?>


Change Language


Follow Navioo On Twitter
gzclose
gzcompress
gzdecode
gzdeflate
gzencode
gzeof
gzfile
gzgetc
gzgets
gzgetss
gzinflate
gzopen
gzpassthru
gzputs
gzread
gzrewind
gzseek
gztell
gzuncompress
gzwrite
readgzfile
zlib_get_coding_type
eXTReMe Tracker