note 56216 added to ref.zlib
| From: | .) | Date: | Sat, 27 Aug 2005 15:27:04 +0000 |
| Subject: | note 56216 added to ref.zlib | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-94261@lists.php.net to get a copy of this message | ||
If you need to compress data and send it as "Content-disposition: attachment" and
on-the-fly to the client due to the size for example (40Mb) here's a dirty trick using
ob_gzhandler()
Keep in mind that $str is the content to output.
When you start the output call
<?php
echo ob_gzhandler($str, PHP_OUTPUT_HANDLER_START);
?>
Then to output any further content
<?php
echo ob_gzhandler($str, PHP_OUTPUT_HANDLER_CONT);
?>
And to close the output
<?php
echo ob_gzhandler('', PHP_OUTPUT_HANDLER_END);
exit;
?>
Only tested on Apache 1.3.33 with PHP 5.0.4
----
Manual Page -- http://www.php.net/manual/en/ref.zlib.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+56216
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56216&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56216&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56216&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56216&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56216&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56216&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+56216&report=yes
Search -- http://master.php.net/manage/user-notes.php