note 8750 modified in function.gzcompress by irchtml

From: Date: Tue, 02 Mar 2004 11:16:28 +0000
Subject: note 8750 modified in function.gzcompress by irchtml
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-66083@lists.php.net to get a copy of this message
gzcompress DOES return gz compressed data. The only thing you still need is the GZ header before any gz compressed output (0x1F 0x8B 0x08 0x00 0x00 0x00 0x00 0x00 0x00). Here is a working example for buffered gz output: <?php Header("Content-Encoding: gzip"); echo "\x1f\x8b\x08\x00\x00\x00\x00\x00"; flush(); ob_start(); ob_implicit_flush(0); // output something, like include("/etc/rc.config"); // end of output $x = ob_get_contents(); ob_end_clean(); echo gzcompress($x,9); ?> --was-- gzcompress DOES return gz compressed data. The only thing you still need is the GZ header before any gz compressed output (0x1F 0x8B 0x08 0x00 0x00 0x00 0x00 0x00 0x00). Here is a working example for buffered gz output: &lt;?php Header("Content-Encoding: gzip"); echo "\x1f\x8b\x08\x00\x00\x00\x00\x00"; flush(); ob_start(); ob_implicit_flush(0); // output something, like include("/etc/rc.config"); // end of output $x = ob_get_contents(); ob_end_clean(); echo gzcompress($x,9); ?> http://www.php.net/manual/en/function.gzcompress.php

« previous php.notes (#66083) next »