Session::request_multiple( array $requests, array $options = array() ): array

Send multiple HTTP requests simultaneously

Description

See also

Parameters

$requestsarrayrequired
$optionsarrayoptional
Global and default options (see WpOrgRequestsRequests::request())

Default:array()

Return

array Responses (either WpOrgRequestsResponse or a WpOrgRequestsException object)

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.