Closing a connection to browser without exiting the script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello there,

I'm having a somewhat unusual question here, and I cannot find any way to solve it.

I have a PHP page that displays a message, and then, performs a very long operation. Note that it displays the message first. I do not intend to give some feedback to the user when the operation is done.

I've seen I can use ignore_user_abort() to prevent the user from stopping the ongoing operation, but that solves only part of my problem. Because as long as the page is not fully loaded, the mouse cursor in the user's browser is showing a watch.

So ideally, what I would like is to be able to close the connection from the server-side, but without using the exit() function, so my script keeps running afterwards.

I know I could use a system() call to launch another process to do the processing, but I would like to avoid doing that, because there are many variables in the context that I cannot easily pass in parameter.

I also tried to use the register_shutdown_function() to perform my operation after the page is displayed but since PHP 4.1.0, the connection is closed after the function is called....

Would any of you have an idea on how I could close that connection?

Thanks a lot,
David
www.thecodingmachine.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux