note 72650 added to function.fopen
| From: | bosmeeuw at gmail dot com | Date: | Sat, 27 Jan 2007 22:11:11 +0000 |
| Subject: | note 72650 added to function.fopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-122283@lists.php.net to get a copy of this message | ||
Here's how to do non-blocking (asynchronous) http requests in PHP. The script beneath is handy
when you need to trigger a remote script which starts up a long process, and you don't care
about its output
<?php
$url = parse_url('http://www.example.com/slow_script.php');
$url['port'] = $url['port'] ? $url['port'] : 80;
$fp = fsockopen($url['host'],$url['port']);
fwrite(
$fp,
"GET {$url['path']}?{$url['query']} HTTP/1.0\r\n" .
"Host: {$url['host']}\r\n"
);
fclose($fp);
?>
----
Server IP: 87.238.162.147
Probable Submitter: 84.192.218.96
----
Manual Page -- http://www.php.net/manual/en/function.fopen.php
Edit -- https://master.php.net/note/edit/72650
Del: integrated -- https://master.php.net/note/delete/72650/integrated
Del: useless -- https://master.php.net/note/delete/72650/useless
Del: bad code -- https://master.php.net/note/delete/72650/bad+code
Del: spam -- https://master.php.net/note/delete/72650/spam
Del: non-english -- https://master.php.net/note/delete/72650/non-english
Del: in docs -- https://master.php.net/note/delete/72650/in+docs
Del: other reasons-- https://master.php.net/note/delete/72650
Reject -- https://master.php.net/note/reject/72650
Search -- https://master.php.net/manage/user-notes.php