note 93436 added to function.gzinflate

From: Date: Thu, 10 Sep 2009 00:13:24 +0000
Subject: note 93436 added to function.gzinflate
Groups: php.notes 
Request: Send a blank email to php-notes+get-160383@lists.php.net to get a copy of this message
The correct function for gzip and chunked data particularly when you get "Content-Encoding: gzip" and "Transfer-Encoding: chunked" headers: function decode_gzip($h,$d,$rn="\r\n"){ if (isset($h['Transfer-Encoding'])){ $lrn = strlen($rn); $str = ''; $ofs=0; do{ $p = strpos($d,$rn,$ofs); $len = hexdec(substr($d,$ofs,$p-$ofs)); $str .= substr($d,$p+$lrn,$len); $ofs = $p+$lrn*2+$len; }while ($d[$ofs]!=='0'); $d=$str; } if (isset($h['Content-Encoding'])) $d = gzinflate(substr($d,10)); return $d; } Enjoy! ---- Server IP: 213.186.192.247 Probable Submitter: 109.86.103.227 ---- Manual Page -- http://www.php.net/manual/en/function.gzinflate.php Edit -- https://master.php.net/note/edit/93436 Del: integrated -- https://master.php.net/note/delete/93436/integrated Del: useless -- https://master.php.net/note/delete/93436/useless Del: bad code -- https://master.php.net/note/delete/93436/bad+code Del: spam -- https://master.php.net/note/delete/93436/spam Del: non-english -- https://master.php.net/note/delete/93436/non-english Del: in docs -- https://master.php.net/note/delete/93436/in+docs Del: other reasons-- https://master.php.net/note/delete/93436 Reject -- https://master.php.net/note/reject/93436 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#160383) next »