[wp-trac] [WordPress Trac] #33055: Support Parallel HTTP Requests in WP_Http, et al
WordPress Trac
noreply at wordpress.org
Wed Oct 28 06:47:54 UTC 2015
#33055: Support Parallel HTTP Requests in WP_Http, et al
----------------------------+-----------------------
Reporter: wonderboymusic | Owner: rmccue
Type: task (blessed) | Status: assigned
Priority: normal | Milestone: 4.4
Component: HTTP API | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
----------------------------+-----------------------
Changes (by rmccue):
* keywords: needs-patch => has-patch
Comment:
Oh, I forgot to address the primary point of this ticket too: you can now
also do parallel requests by using Requests directly:
{{{
// Setup what we want to request
$requests = array(
array(
'url' => 'http://httpbin.org/get',
'headers' => array('Accept' => 'application/javascript'),
),
'post' => array(
'url' => 'http://httpbin.org/post',
'data' => array('mydata' => 'something'),
),
'delayed' => array(
'url' => 'http://httpbin.org/delay/10',
'options' => array(
'timeout' => 20,
),
),
);
$options = array(
'complete' => function my_callback(&$request, $id) {
var_dump($id, $request);
},
);
$responses = Requests::request_multiple($requests, $options);
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33055#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list