note 10402 modified in function.gzcompress by irchtml
| From: | irchtml@php.net | Date: | Tue, 02 Mar 2004 11:28:47 +0000 |
| Subject: | note 10402 modified in function.gzcompress by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-66093@lists.php.net to get a copy of this message | ||
>>Netscape 4 (on all platforms[?]), IE4/IE5 on the Mac do NOT support
>>gz-compression. Email me if you want to know more.
As a matter of fact, Netscape 4.7x on Win32 DOES support gz-compression. Calling the following
script in my auto_prepend directive seems to work fine. The script is taken from the Output
Buffering article on Zend.com (http://www.zend.com/zend/art/buffering.php). As noted in the
article, it only works with PHP 4.0.4 and higher.
<?php
// function to compress the output buffer in preparation for transmission to client
function compress_output($output) {
// compress and return the output buffer
return gzencode($output);
}
// Check if the browser supports gzip encoding, HTTP_ACCEPT_ENCODING
if (strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) {
// Start output buffering, and register compress_output()
ob_start("compress_output");
// Tell the browser the content is compressed with gzip
header("Content-Encoding: gzip");
}
?>
--was--
>>Netscape 4 (on all platforms[?]), IE4/IE5 on the Mac do NOT support
>>gz-compression. Email me if you want to know more.
As a matter of fact, Netscape 4.7x on Win32 DOES support gz-compression. Calling the following
script in my auto_prepend directive seems to work fine. The script is taken from the Output
Buffering article on Zend.com (http://www.zend.com/zend/art/buffering.php). As noted in the
article, it only works with PHP 4.0.4 and higher.
<?php
// function to compress the output buffer in preparation for transmission to client
function compress_output($output) {
// compress and return the output buffer
return gzencode($output);
}
// Check if the browser supports gzip encoding, HTTP_ACCEPT_ENCODING
if (strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) {
// Start output buffering, and register compress_output()
ob_start("compress_output");
// Tell the browser the content is compressed with gzip
header("Content-Encoding: gzip");
}
?>
http://www.php.net/manual/en/function.gzcompress.php