ktsirig Posted May 31, 2006 Share Posted May 31, 2006 Hello!I am having a problem that I think is solved by using sessions and page refresh.I have a page where the user enters data. The data are used as input for an external program that runs in the shell, irrelevant to PHP. When the program ends, all results are stored in a text file, which I open with PHP and parse the results so that the user sees them on screen.So I have :form.php => which contains the form[....] => external program that runs in the background and creates temporary text file with the resultsprocess.php => opens text file and prints the resultsWhat I would like to do is something I have seen in many websites. I want to have an 'intermediate' page that will say for example "Please wait, we are processing your request".... This page will automatically refresh when the external program ends and then it will redirect to process.php file to show the results.I think it is better to have such a page instead of 'stucking' to the initial page [form.php] during the processing time and then display the results.Note that the external program can end in 1 minute, but it can last for 4 or 5 minutes if the user has submitted lots of data.Any ideas on how to do this? Quote Link to comment https://forums.phpfreaks.com/topic/10831-php-sessions-page-refresh/ Share on other sites More sharing options...
rathfon Posted May 31, 2006 Share Posted May 31, 2006 Well, first of all, how does process.php know that the text file is ready to be opened (read: finished)? or do you have it set to open the file after a certain amount of time?You might be able to set up a middle-man page that checks for.. I suppose the 'existance' of the certain text file, and then wait's atleast 10 seconds if it's not found, then looks again (while displaying 'Loading' or whatever you may want). The external program, hopefully written by you, or having the possibility to be modified should be set to hold the data in it's buffer then to write all the data to the textfile at once if you happened to use the check for the existance of the file method I just specified so it doesn't open the file mid-write.I'm not that experienced with external program use and PHP, so I might just be totally wrong on this. But I'm sure there is someone else here who could help. Quote Link to comment https://forums.phpfreaks.com/topic/10831-php-sessions-page-refresh/#findComment-40480 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.