//Example of use
backgroundPost(‘http://example.com/slow_async_script.php?id=’.urlencode(‘file.txt’));

Don’t forget to change “User-Agent” to something more meaningful for you.

The function backgroundPost opens TCP/IP connection to specified $url and makes HTTP POST. Right after data is submitted to the server, we close connection using fclose function, but the background script keeps running. If the background script is on the same server, we have two PHP scripts running simultaneously.

As suggested in the w-shadow.com I use ignore_user_abort(true); in the slow_async_script.php, so that PHP or Apache keep my script running even after we have aborted connection to it (using socket close command fclose).