Page 1 of 1

help in monitoring progress on the server

Posted: Sun Jul 15, 2007 1:33 pm
by jasongr
Hello people

This is not really a PHP question, but more closely relates to the my ability to monitor an
activity on the server from the browser.
I think that most of the people who use these forums are very clever and I hope to find a solution
to my problem.

I have a PHP code that runs on the server and updates the content of a file.
What I need is someway of writing the size of that file to the user's browser but keep that size updating as the size of the file is updated on the server.
Basically I have 2 processes:
One running on the server and updates the file
The second is updating the size of the file on the user browser as the file size changes on the server.

My question is:
What is the recommended way of updating the size of the file on the user's browser.
I don't want to communicate with the server using an iframe that will get the file size and will update
the value on the screen using JavaScript.
The reason is in such a solution, the content-type of the page that gets invoked by the iframe will be text/html
which makes this page very expensive when accessed a lot using Akami.

I am sure that this sort of problem is very common, especially today when many sites use AJAX.
I hope to get as many suggestions as possible

regards
Jason

Posted: Sun Jul 15, 2007 1:38 pm
by feyd
Initiate the processing script via an internal request. You can have a script that can poll the file's size separate from that which you can query in any manner of ways.

Posted: Sun Jul 15, 2007 1:41 pm
by jasongr
Yes, I know.
My question is not on the internal script.
My question is on the process that will poll the server.
I know that there are several ways of polling the server. The point of this thread
is to familiar me with those ways, so I could pick the one that is right for my application

thanks
Jason

Posted: Sun Jul 15, 2007 1:46 pm
by feyd
The basic ways are meta-refresh and Ajax. Variants may use frames/iframes, as you have said, but the fundamentals don't change.

Posted: Sun Jul 15, 2007 1:59 pm
by jasongr
I like the solution that uses AJAX to communicate with the PHP page that returns the response in a content-type that is not text/html.

can anyone refer me to a good source for reading on this?

Posted: Sun Jul 15, 2007 2:25 pm
by feyd
Jquery and the other major Ajax/DHTML frameworks should be good starting points.

Posted: Sun Jul 15, 2007 11:40 pm
by jasongr
Thanks, I willl check this out