Yesterday we discussed the ability to run a process
from a web page, without forcing the browser to wait
for the called process to end execution. The request
could come from a webbug( a small blank image that
triggers another script )

One excellent solution can be found in DokuWiki
Indexer driver( The script that calls the search, or
sitemap indexer ).

http://dev.splitbrain.org/reference/dokuwiki/nav.html?lib/exe/indexer.php.source.html

The idea is to send a 1x1 gif to the broswer and then
close the connection.

   header('Connection: Close');

But how does the called process continue to run after
the broswer closes or aborts the connection? A simple
call as follows does the trick( must be called before
closing the connection of course )

14  // keep running after browser closes connection
15  @ignore_user_abort(true);

The script will also capture any output sent
afterwards by truning output buffering on. This is
just to make sure that some browsers won't mess things
up if they receive content after a connection close
request.

A side note, although not mentioned anywhere in the
script, but allow your script to run indefinitly, to
make sure it doesn't end because of time limit:

set_time_limit( 0 );


Happy Hacking

Ammar


                
__________________________________________ 
Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com 


_______________________________________________
General mailing list
[email protected]
http://mail.jolug.org/mailman/listinfo/general_jolug.org

Reply via email to