PHP Social Network Bot on GitHub
This is a script I threw together back in 2009. The code is really shoddy, but it is a decent proof of concept for building AJAX applications in PHP and displaying a status bar of updates throughout the execution of a long running PHP task.
The main guts of the script is bot.php, which uses an often overlooked PHP feature:
ignore_user_abort(TRUE); # Closing browser will not kill script set_time_limit(0); # Script will run indefinitely
Notice the ignore_user_abort() function. Normally, when a browser window is closed, it tells the server to abort the request, even when we set the time limit to 0 (infinity). This function prevents the server from halting the execution of the script when this happens.