|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi,
First of all, I am looking for a way to force the execution of a php script to explicitly stop when told to do so by the client connection. I know when you hit the browser stop button php normally stops, but it doesn't stop immediately (ie. if the script is in a loop, it will keep going for a bit). Also, I am looking for a way to force php to stay alive, even if the connection to the client drops. Finally, does anyone know of a way to enable chatter between a single php script and its client (ie. php well send out something, then the client will respond, and then php will send another something, ...) Thanks, Daniel |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Feb 14, 9:36 am, Dan99 <power...@gmail.com> wrote:
> Hi, > > First of all, I am looking for a way to force the execution of a php > script to explicitly stop when told to do so by the client > connection. I know when you hit the browser stop button php normally > stops, but it doesn't stop immediately (ie. if the script is in a > loop, it will keep going for a bit). Also, I am looking for a way to > force php to stay alive, even if the connection to the client drops. > Finally, does anyone know of a way to enable chatter between a single > php script and its client (ie. php well send out something, then the > client will respond, and then php will send another something, ...) > > Thanks, > Daniel Use ignore_user_abort(): <http://www.php.net/ignore_user_abort> That will definitely answer your second question. I'm not sure if there's much you can do about the first one, though. You might try checking inside the loop if the connection has been aborted and then breaking out of it. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Thu, 14 Feb 2008 16:20:50 +0100, ZeldorBlat <zeldorblat@gmail.com>
wrote: > On Feb 14, 9:36 am, Dan99 <power...@gmail.com> wrote: >> Hi, >> >> First of all, I am looking for a way to force the execution of a php >> script to explicitly stop when told to do so by the client >> connection. I know when you hit the browser stop button php normally >> stops, but it doesn't stop immediately (ie. if the script is in a >> loop, it will keep going for a bit). Also, I am looking for a way to >> force php to stay alive, even if the connection to the client drops. >> Finally, does anyone know of a way to enable chatter between a single >> php script and its client (ie. php well send out something, then the >> client will respond, and then php will send another something, ...) >> >> Thanks, >> Daniel > > Use ignore_user_abort(): > > <http://www.php.net/ignore_user_abort> > > That will definitely answer your second question. I'm not sure if > there's much you can do about the first one, though. You might try > checking inside the loop if the connection has been aborted and then > breaking out of it. In a HTML context, spaces are no content, and if you have no buffering mechanism somewhere, a simple statement like this in every loop: echo ' '; flush(); if(connection_aborted()) exit; ....could very well halt execution sooner. However, if you need to stop 'dead on', HTTP is not the way to go. -- Rik Wasmus |
|
![]() |
| Outils de la discussion | |
|
|