note 87928 modified in function.bzopen by danbrown

From: Date: Wed, 31 Dec 2008 03:20:28 +0000
Subject: note 87928 modified in function.bzopen by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-148709@lists.php.net to get a copy of this message
In some circumstances, you may want to send a bzip2 stream to the client. To do this, you need only do: <?php ob_flush(); $bz = bzopen('php://stdout', 'w'); bzwrite($bz, 'some input here'); bzclose($bz); ?> However, please note, because you are using STDOUT, you need to ob_flush() before actually writing to the stream. Otherwise, you might be sending data before the headers, which will cause errors on both server and client ends, in most cases. You might be able to use php://output rather than php://stdout, however in my tests (with Linux), php://output doesn't actually work - at all. --was-- In some circumstances, you may want to send a bzip2 stream to the client. To do this, you need only do: <? ob_flush(); $bz = bzopen('php://stdout', 'w'); bzwrite($bz, 'some input here'); bzclose($bz); ?> However, please note, because you are using STDOUT, you need to ob_flush() before actually writing to the stream. Otherwise, you might be sending data before the headers, which will cause errors on both server and client ends, in most cases. You might be able to use php://output rather than php://stdout, however in my tests (with Linux), php://output doesn't actually work - at all. http://php.net/manual/en/function.bzopen.php

« previous php.notes (#148709) next »