Page 1 of 1

HTML output in parts not all at once ?

Posted: Thu Apr 24, 2003 9:01 am
by Kari
Hi All,
Php is processing and buffering all html before output, I think...
Is it possible to output html in parts ? Like:
function1 sends html head & body tags
function2 sends character '*'
function3 does something, 1 sec. delay for example
now
function2 sends charcter '*' again but so that it is
added after previous charcter 1 sec later,
function4 sends closing tags
I have tried this with loops but what happens is that all
code is processed and html is output at once.
I would like page to show current php script run status
in ' realtime ' like ' Reading file 1 ' after it is read script
adds to page ' Processing file 1 ' and so on, hope you
understand what I mean.

Thanks,
Kari

Posted: Thu Apr 24, 2003 9:03 am
by []InTeR[]
Try the php command flush();

Posted: Thu Apr 24, 2003 9:50 am
by Kari
Inter,
Thank you very much! flush() was exactly
what I was looking for.
Php function list says win32 servers
and some other buffer html anyway.
Got it working on my Win98 home PC
( with Apache ) and Linux/Apache.
There was also good info about browser
buffers on php.net function list.

Thanks again,
Kari

Posted: Thu Apr 24, 2003 9:55 am
by []InTeR[]
You'r welcome.

Posted: Thu Apr 24, 2003 2:28 pm
by nigma
I am currently looking in the php manual for something on the flush function, but maybe someone can tell me what it is generally used for?

Posted: Thu Apr 24, 2003 4:28 pm
by []InTeR[]
The output of php to the browser or a other program that's requesting your script, is bufferd.

To flush and send this buffer the flush command is called.

PHP does this automatic if the buffer is full, but you can allso set php to ignore flush or flush every thing you'r gonna output.

Posted: Thu Apr 24, 2003 7:05 pm
by m3mn0n
php.net/any_function

will get you info about the particular function...eg...

http://www.php.net/flush