note 71789 deleted from function.gzcompress by nlopess

From: Date: Sun, 17 Dec 2006 19:26:27 +0000
Subject: note 71789 deleted from function.gzcompress by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-120692@lists.php.net to get a copy of this message
Note Submitter: mike at website-tech dot com Reason: useless ---- Although the W3C validator doesn't seem to validate gzip compressed pages directly from gzcompress(), it does look like it validates phpBB forums (which do use gzcompress()). Here's the excerpt from page_tail.php that does it: <?php if ( $do_gzip_compress ) { // // Borrowed from php.net! // $gzip_contents = ob_get_contents(); ob_end_clean(); $gzip_size = strlen($gzip_contents); $gzip_crc = crc32($gzip_contents); $gzip_contents = gzcompress($gzip_contents, 9); $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4); echo "\x1f\x8b\x08\x00\x00\x00\x00\x00"; echo $gzip_contents; echo pack('V', $gzip_crc); echo pack('V', $gzip_size); } ?> I guess those extra things echoed at the end must make it work right.

« previous php.notes (#120692) next »