note 71789 added to function.gzcompress

From: Date: Fri, 15 Dec 2006 21:39:08 +0000
Subject: note 71789 added to function.gzcompress
Groups: php.notes 
Request: Send a blank email to php-notes+get-120644@lists.php.net to get a copy of this message
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. ---- Server IP: 64.71.164.2 Probable Submitter: 68.80.117.151 ---- Manual Page -- http://www.php.net/manual/en/function.gzcompress.php Edit -- https://master.php.net/note/edit/71789 Del: integrated -- https://master.php.net/note/delete/71789/integrated Del: useless -- https://master.php.net/note/delete/71789/useless Del: bad code -- https://master.php.net/note/delete/71789/bad+code Del: spam -- https://master.php.net/note/delete/71789/spam Del: non-english -- https://master.php.net/note/delete/71789/non-english Del: in docs -- https://master.php.net/note/delete/71789/in+docs Del: other reasons-- https://master.php.net/note/delete/71789 Reject -- https://master.php.net/note/reject/71789 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120644) next »