I have a php file , For example http://domain.com/user?id=uniquetoken ,When user visits that url with unique token it does lots of stuffs using javascript and php and it takes atleast 2 minutes to complete a certain task.If the user is not patient and closes the window that task is not performed at all, What i need is when the user just visit http://domain.com/user?id=token , the task must me done in background.so even if user closes the window the task should be completed by php in backend,
I have some ideas like , file_get_contents, will that complete the task completely?Any ideas or suggestion please?
edit :
Somebody tell me if file_get_contents(http://domain.com/user?id=token) , another php file works? even after they close it immediately?? i have enabled ignore_user_abort().
when user visits
http://domain.com/user?id=tokenjust call anexec()on the php script you want to run.If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Once
exec()is started with output redirection, it will continue to execute in server even if user closes the browser.