Re: Run a php script as a separate thread/process

From: Date: Wed, 12 Oct 2005 09:51:51 +0000
Subject: Re: Run a php script as a separate thread/process
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-223950@lists.php.net to get a copy of this message
Thank you very much. This is what I ended up with if anyone needs it: <?php function runSeparateThread($strHost, $strPath="/") { $fFile = fsockopen($strHost, 80, $intError, $strError); if ($fFile) { $out = "GET ".$strPath." HTTP/1.1\r\n"; $out .= "Host: ".$strHost."\r\n"; $out .= "Connection: Close\r\n\r\n"; if(!fwrite($fFile, $out)){ $result = "runSeparateThread():fwrite(). Could not write:'".$out."'. Host:'".$strHost."'. Path:'".$strPath."'"; } else { $result = true; } fclose($fFile); } else { $result = "runSeparateThread():fsockopen(): Could not connect to ".$strHost." (".$intError.") ".$strError."."; } return $result; } ?>

« previous php.general (#223950) next »