note 77183 added to function.ob-start

From: Date: Sun, 19 Aug 2007 00:24:20 +0000
Subject: note 77183 added to function.ob-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-129581@lists.php.net to get a copy of this message
I am not sure why I used this as ob_gzhandler automatically checks if the client accepts gzip. Well, i added this code to assure myself LOL <?php $acceptencoding = explode(',' ,$_SERVER['HTTP_ACCEPT_ENCODING']); foreach($acceptencoding as $id=>$encode){$acceptencoding[$id] = trim($encode);} if(in_array('gzip',$acceptencoding)){ ob_start('ob_gzhandler'); header('Content-Encoding: gzip'); } ?> It will check if the client accepts gzip encoding via the $_SERVER['HTTP_ACCEPT_ENCODING'] variable. Then splits up the commas and trim whitespaces. If gzip is in the $acceptencoding variable, we can perform ob_gzhandler and send a gzip Content-Encoding header. Used successfully on http://betapod.hellclanner.com/ ---- Server IP: 202.79.178.91 Probable Submitter: 202.156.12.10 (proxied: 222.165.25.57) ---- Manual Page -- http://www.php.net/manual/en/function.ob-start.php Edit -- https://master.php.net/note/edit/77183 Del: integrated -- https://master.php.net/note/delete/77183/integrated Del: useless -- https://master.php.net/note/delete/77183/useless Del: bad code -- https://master.php.net/note/delete/77183/bad+code Del: spam -- https://master.php.net/note/delete/77183/spam Del: non-english -- https://master.php.net/note/delete/77183/non-english Del: in docs -- https://master.php.net/note/delete/77183/in+docs Del: other reasons-- https://master.php.net/note/delete/77183 Reject -- https://master.php.net/note/reject/77183 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129581) next »