Sends the request using curl_multi_exec()
, enabling parallel requests. Uses the “rolling” method.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
An indexed array of cURL handles to process simultaneously. |
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
Post-processed cURL responses. |
Examples
Collect cURL handles for two requests, fire them, and then display the response bodies.
$http = new RequestCore(); $responses = $http->send_multi_request(array( $http->set_request_url('http://github.com/skyzyx/requestcore/raw/master/_tests/test_request.txt')->prep_request(), $http->set_request_url('http://github.com/skyzyx/requestcore/raw/master/_tests/test_request2.txt')->prep_request() )); $bodies = array( $responses[0]->body, $responses[1]->body, ); var_dump($bodies);Result:
array(2) { [0]=> string(48) "abcdefghijklmnopqrstuvwxyz 0123456789 !@#$%^&*()" [1]=> string(48) ")(*&^%$#@! 9876543210 zyxwvutsrqponmljkihgfedcba" }
Source
Method defined in lib/requestcore/requestcore.class.php | Toggle source view (85 lines) | View on GitHub