Connecting Tech Pros Worldwide Forums | Help | Site Map

idea needed: Longrunning PHP-script/continious stream/browser 'pagerenew'

Erwin Moller
Guest
 
Posts: n/a
#1: Mar 31 '06
Hi,

I have a little problem figuring out something that solves the folowwing
problem:
1) 1 script that can run for many hours (days).
It will output regulary some information.
2) A browser that displays it.

So the browser will receive a stream of information over hours, and the php
script will output it (using flushing probably to make sure the browser
knows the stream is still alive.)

Ideally I would like to give the browser some command to throw away all the
old output to keep it fast and not having megabytes of info on the page.

But that means a new http-request, which doesn't suit my needs.

AFAIK this is not possible, but if it is possible somehow, please tell me.
If you think it is completely impossible, also please tell me. :-)

Thanks for your time.

Kind regards,
Erwin Moller

David Haynes
Guest
 
Posts: n/a
#2: Mar 31 '06

re: idea needed: Longrunning PHP-script/continious stream/browser 'pagerenew'


Erwin Moller wrote:[color=blue]
> Hi,
>
> I have a little problem figuring out something that solves the folowwing
> problem:
> 1) 1 script that can run for many hours (days).
> It will output regulary some information.
> 2) A browser that displays it.
>
> So the browser will receive a stream of information over hours, and the php
> script will output it (using flushing probably to make sure the browser
> knows the stream is still alive.)
>
> Ideally I would like to give the browser some command to throw away all the
> old output to keep it fast and not having megabytes of info on the page.
>
> But that means a new http-request, which doesn't suit my needs.
>
> AFAIK this is not possible, but if it is possible somehow, please tell me.
> If you think it is completely impossible, also please tell me. :-)
>
> Thanks for your time.
>
> Kind regards,
> Erwin Moller[/color]
Why not buffer the output at the backend (file or database) and then let
the browser refresh on a cyclic basis?

-david-

Sjoerd
Guest
 
Posts: n/a
#3: Mar 31 '06

re: idea needed: Longrunning PHP-script/continious stream/browser 'pagerenew'



Erwin Moller wrote:[color=blue]
> I have a little problem figuring out something that solves the folowwing
> problem:
> 1) 1 script that can run for many hours (days).
> It will output regulary some information.
> 2) A browser that displays it.[/color]

The script could save its output to a file, which is repeatedly loaded
by a browser. Javascript can be used to refresh the page once in a
while.

Alternatively, you can make a Java applet which receives the data on a
socket.

Erwin Moller
Guest
 
Posts: n/a
#4: Mar 31 '06

re: idea needed: Longrunning PHP-script/continious stream/browser 'pagerenew'


Sjoerd wrote:
[color=blue]
>
> Erwin Moller wrote:[color=green]
>> I have a little problem figuring out something that solves the folowwing
>> problem:
>> 1) 1 script that can run for many hours (days).
>> It will output regulary some information.
>> 2) A browser that displays it.[/color]
>
> The script could save its output to a file, which is repeatedly loaded
> by a browser. Javascript can be used to refresh the page once in a
> while.
>
> Alternatively, you can make a Java applet which receives the data on a
> socket.[/color]

Thanks David and Sjoerd,

I think storing the 'parts' (I want to spit out to HTML) in the database
with some time-index, which I poll from the client (using JS) is indeed a
good solution.
It gives me the flexibility to retrieve some pieces from the 'past' too in
the browser.
Easy actually, once you think of it. :-)

Thanks for your prompt responses!

Regards,
Erwin Moller
Closed Thread