note 54183 added to function.ignore-user-abort

From: Date: Sun, 26 Jun 2005 23:57:01 +0000
Subject: note 54183 added to function.ignore-user-abort
Groups: php.notes 
Request: Send a blank email to php-notes+get-90974@lists.php.net to get a copy of this message
I wrote a simple function that can "spawn" another thread within the webserver by making async http request. The page that is being spawned can call ignore_user_abort() and do whatever it wants in the background... <?php function http_spawn($page) { $basepath=ereg_replace('[^/]*$', '', $_SERVER['PHP_SELF']); $cbSock=fsockopen('localhost', $_SERVER['SERVER_PORT'], $errno, $errstr, 5); if ($cbSock) { fwrite($cbSock, "GET {$basepath}{$page} HTTP/1.0\r\n" ."Host: {$_SERVER['HTTP_HOST']}\r\n\r\n"); } } ?> Example: <?php if ($search_initialized) http_spawn("ftindex.php"); ?> ---- Manual Page -- http://www.php.net/manual/en/function.ignore-user-abort.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+54183 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54183&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54183&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54183&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54183&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54183&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54183&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+54183&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#90974) next »