Re: Printing to a buffer

From: Date: Sat, 12 Nov 2005 23:10:36 +0000
Subject: Re: Printing to a buffer
References: 1 2  Groups: php.general php.general 
Request: Send a blank email to php-general+get-225686@lists.php.net to get a copy of this message
Yup! It was the missing parentheses! Works as planned. Many thanks.... The "application/text" gives the user the ability; "text/plain" does not seem to do that. I just tried "application/text" since I use "application/pdf" for other applications. Todd Jasper Bryant-Greene wrote:
Todd Cary wrote:
My client's new shared server does not allow printing to a file, so I want my print statement to print to a buffer, then I'll send it to the user via Headers. This does not work since "print" does no go to the buffer, or at least appears not to: I get the errors from the header statements; <? ob_start;
You're missing some parentheses on the ob_start function. I think you meant to write: ob_start();
print "This is a test<bf>";
You probably meant <br> in that string too.
$buf = ob_get_contents(); $len = strlen($buf); ob_end_clean(); header("Content-type: application/text");
application/text isn't a MIME-Type, is it? Do you mean text/plain?
header("Content-Length: $len"); header("Content-Disposition: inline; filename=Sfyc.html"); print($buf); ?> Todd


« previous php.general (#225686) next »