Keeping script running, but returning control to user?
| From: | Leif K-Brooks | Date: | Tue, 31 Dec 2002 02:12:37 +0000 |
| Subject: | Keeping script running, but returning control to user? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-129725@lists.php.net to get a copy of this message | ||
I need a way to keep the script running on the server, but control to the user. I'm doing some lengthy processes on the server, and it seems stupid to keep the user waiting pointlessly. I'm trying to do something like:
<?php
if(array_key_exists('secondrun',$_GET)){
print "Processing complete!";
exit;
}
header("Location: http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?secondrun=1");
//Do long processing here
?>
but it waits till the long processing is done, and then redirects. Is there another way to do this?
--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it
will be prosecuted to the full extent of the law.