Requests_Transport_fsockopen::request_multiple() public WP 1.0
Send multiple requests simultaneously
{} It's a method of the class: Requests_Transport_fsockopen{}
No Hooks.
Return
Array. Array of Requests_Response objects (may contain Requests_Exception or string responses as well)
Usage
$Requests_Transport_fsockopen = new Requests_Transport_fsockopen(); $Requests_Transport_fsockopen->request_multiple( $requests, $options );
- $requests(array) (required)
- Request data (array of 'url', 'headers', 'data', 'options') as per Requests_Transport::request
- $options(array) (required)
- Global options, see {@see Requests::response()} for documentation
Code of Requests_Transport_fsockopen::request_multiple() Requests Transport fsockopen::request multiple WP 5.6
public function request_multiple($requests, $options) {
$responses = array();
$class = get_class($this);
foreach ($requests as $id => $request) {
try {
$handler = new $class();
$responses[$id] = $handler->request($request['url'], $request['headers'], $request['data'], $request['options']);
$request['options']['hooks']->dispatch('transport.internal.parse_response', array(&$responses[$id], $request));
}
catch (Requests_Exception $e) {
$responses[$id] = $e;
}
if (!is_string($responses[$id])) {
$request['options']['hooks']->dispatch('multiple.request.complete', array(&$responses[$id], $id));
}
}
return $responses;
}