note 77183 deleted from function.ob-start by nlopess
| From: | nlopess@php.net | Date: | Sat, 01 Sep 2007 11:58:19 +0000 |
| Subject: | note 77183 deleted from function.ob-start by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-129996@lists.php.net to get a copy of this message | ||
Note Submitter: Sam Yong - hellclanner [at] live dot com
Reason: spam
----
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/