You are here: Re: [PHP] Printing to a buffer « PHP « IT news, forums, messages
Re: [PHP] Printing to a buffer

Posted by Todd Cary on 11/14/05 00:55

Because this was just a test of what will be many "print" lines. The
original application used a file to hold the data and upon request by
the user, it was emailed. But with my client's shared server, files
cannot be opened...a pain.

If you have a better solution, I am open to other ideas.

Todd

M. Sokolewicz wrote:
> call me stupid, but why don't you do it like this:
>
> $buf = "This is a test<br>";
> header("Content-type: text/plain");
> header("Content-Length: ".strlen($buf));
> header("Content-Disposition: attachment; filename=sfyc.html");
> echo $buf;
>
> ??
> looks easier to me... no output buffering required...
>
> Todd Cary wrote:
>
>>
>> Just before the police knocked at my door, I made a few changes!
>>
>> <?
>> ob_start();
>> print "This is a test<br>";
>> $buf = ob_get_contents();
>> $len = strlen($buf);
>> ob_end_clean();
>> header("Content-type: text/plain");
>> header("Content-Length: $len");
>> header("Content-Disposition: attachment; filename=sfyc.html");
>> print($buf);
>> ?>
>>
>> Todd
>> Marcus Bointon wrote:
>>
>>> On 13 Nov 2005, at 19:27, Jasper Bryant-Greene wrote:
>>>
>>>>> Many thanks! I did not know that MIME-Type. Change duly made!
>>>>
>>>>
>>>>
>>>>
>>>> You're not suggesting that you actually set the MIME-Type to
>>>> application/force-download, are you?
>>>
>>>
>>>
>>>
>>> I think he is. I've called the MIME-type police and they'll be round
>>> later.
>>>
>>> Todd, I think you should read this: http://support.microsoft.com/kb/
>>> q260519/
>>>
>>> There's a PHP example just before the user notes here: http://
>>> www.php.net/header
>>>
>>> Marcus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация