note 101969 deleted from features.connection-handling by danbrown
| From: | danbrown@php.net | Date: | Thu, 20 Jan 2011 18:39:02 +0000 |
| Subject: | note 101969 deleted from features.connection-handling by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-175946@lists.php.net to get a copy of this message | ||
Note Submitter: foobuilder at gmail dot com
----
Simplified the solution a bit:
<?php
header('Connection: close'); // Tell the client to close the connection.
header('Content-Length: 0'); // Tell the client not to expect any data.
flush(); // Render the headers which disconnects the client before the rest of the script executes.
sleep(60);
error_log('It works!');
?>
The trick is to make sure nothing is sent to the client before you set the headers.