Send multiple HTTP requests simultaneously
Description
See also
Parameters
$requests
arrayrequired- Requests data (see WpOrgRequestsRequests::request_multiple())
$options
arrayoptional- Global and default options (see WpOrgRequestsRequests::request())
Default:
array()
Source
public function request_multiple($requests, $options = []) {
if (InputValidator::has_array_access($requests) === false || InputValidator::is_iterable($requests) === false) {
throw InvalidArgument::create(1, '$requests', 'array|ArrayAccess&Traversable', gettype($requests));
}
if (is_array($options) === false) {
throw InvalidArgument::create(2, '$options', 'array', gettype($options));
}
foreach ($requests as $key => $request) {
$requests[$key] = $this->merge_request($request, false);
}
$options = array_merge($this->options, $options);
// Disallow forcing the type, as that's a per request setting
unset($options['type']);
return Requests::request_multiple($requests, $options);
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.