note 77336 modified in function.gzinflate by danbrown
| From: | danbrown@php.net | Date: | Thu, 10 Sep 2009 00:11:27 +0000 |
| Subject: | note 77336 modified in function.gzinflate by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160378@lists.php.net to get a copy of this message | ||
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
<?php
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;
}
?>
--was--
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;
}
?>
http://php.net/manual/en/function.gzinflate.php