Forum Moderators: coopster

Message Too Old, No Replies

Using ob_start with ob_gzhandler

         

dan121

3:33 pm on Jul 29, 2005 (gmt 0)

10+ Year Member



Any ideas on how to combine the two functions below? In the example, I'd like to replace apples with oranges and then use ob_gzhandler to serve up the compressed page. Is this possible?

<?php

function callback($buffer)
{
// replace all the apples with oranges
return (str_replace("apples", "oranges", $buffer));
}

ob_start("callback");

?>
<html>
<body>
<p>It's like comparing apples to oranges.</p>
</body>
</html>
<?php>

ob_end_flush();

?>

combined with:

<?php

ob_start("ob_gzhandler");

?>
<html>
<body>
<p>It's like comparing apples to oranges compressed page.</p>
</body>
</html>

coopster

1:35 am on Aug 3, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Yeah, don't use ob_gzhandler ;)


Note: You cannot use both ob_gzhandler() and zlib.output_compression [php.net]. Also note that using zlib.output_compression is preferred over ob_gzhandler().

Resource:
[php.net...]