note 118142 added to function.curl-multi-init
| From: | w_haigh at yahoo dot com | Date: | Tue, 13 Oct 2015 15:46:11 +0000 |
| Subject: | note 118142 added to function.curl-multi-init | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-203949@lists.php.net to get a copy of this message | ||
Here's an easier to follow example, From : http://arguments.callee.info/2010/02/21/multiple-curl-requests-with-php/
// build the individual requests, but do not execute them
$ch_1 = curl_init('http://webservice.one.com/');
$ch_2 = curl_init('http://webservice.two.com/');
curl_setopt($ch_1, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch_2, CURLOPT_RETURNTRANSFER, true);
// build the multi-curl handle, adding both $ch
$mh = curl_multi_init();
curl_multi_add_handle($mh, $ch_1);
curl_multi_add_handle($mh, $ch_2);
// execute all queries simultaneously, and continue when all are complete
$running = null;
do {
curl_multi_exec($mh, $running);
} while ($running);
//close the handles
curl_multi_remove_handle($mh, $ch1);
curl_multi_remove_handle($mh, $ch2);
curl_multi_close($mh);
// all of our requests are done, we can now access the results
$response_1 = curl_multi_getcontent($ch_1);
$response_2 = curl_multi_getcontent($ch_2);
echo "$response_1 $response_2"; // output results
----
Server IP: 72.52.91.14
Probable Submitter: 217.41.22.42
----
Manual Page -- http://php.net/manual/en/function.curl-multi-init.php
Edit -- https://master.php.net/note/edit/118142
Del: integrated -- https://master.php.net/note/delete/118142/integrated
Del: useless -- https://master.php.net/note/delete/118142/useless
Del: bad code -- https://master.php.net/note/delete/118142/bad+code
Del: spam -- https://master.php.net/note/delete/118142/spam
Del: non-english -- https://master.php.net/note/delete/118142/non-english
Del: in docs -- https://master.php.net/note/delete/118142/in+docs
Del: other reasons-- https://master.php.net/note/delete/118142
Reject -- https://master.php.net/note/reject/118142
Search -- https://master.php.net/manage/user-notes.php