How to send gzip content
| From: | Heiko Mundle | Date: | Tue, 17 Sep 2002 09:51:14 +0000 |
| Subject: | How to send gzip content | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-116610@lists.php.net to get a copy of this message | ||
Hi,
this question is not about compressing HTML content, but SVG or VRML!
i want to compress the entire output with gzip before sending it to the client. I found the function ob_start('ob_gzhandler') but this seems to compress only in special cases. (Actually I don't see if the content is compressed, how can I check this out?)
But for my SVG or VRML content the plugins always support compressed files, even if the browser doesn't. Therefore I want to ensure sending compressed content.
Then I found the "gzencode -- Create a gzip compressed string" function. I tried to use it like this:
<?php
ob_start();
?>
SVG or VRML content
<?php
$sContent = ob_get_contents();
ob_end_clean();
echo gzencode($sContent);
?>
But now I get this error:
Fatal error: Call to undefined function: gzencode() ...
What do I need to do to use the Zlib Compression Functions?
System:
PHP Version 4.2.2
Windows NT 5.0 build 2195
Apache/1.3.24
HTTP_ACCEPT_ENCODING: gzip, deflate