note 112421 deleted from features.connection-handling by googleguy
| From: | googleguy@php.net | Date: | Fri, 14 Jun 2013 22:53:33 +0000 |
| Subject: | note 112421 deleted from features.connection-handling by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-195226@lists.php.net to get a copy of this message | ||
Note Submitter: ZelStudio
----
After many hours, this code close client's connection (supporting zlib, ajax and ios connexion
handler)
function closeConnexion($html = "\r\n")
{
ignore_user_abort(true);
set_time_limit($GLOBALS['WEBSERVICES_TIMEOUT_WS']);
ob_start();
if(session_id())
session_write_close();
echo $html;
$data = ob_get_contents();
$size = ob_get_length();
ob_end_clean();
header("Connection: close");
header("Content-Length: $size\r\n\r\n");
echo $data;
ob_end_flush();
flush();
while(ob_get_level()> 0) ob_end_clean();
}