Session::request( string $url, array $headers = array(), array|null $data = array(), string $type = WpOrgRequestsRequests::GET, array $options = array() ): WpOrgRequestsResponse

Main interface for HTTP requests

Description

This method initiates a request and sends it via a transport before parsing.

See also

Parameters

$urlstringrequired
URL to request
$headersarrayoptional
Extra headers to send with the request

Default:array()

$dataarray|nulloptional
Data to send either as a query string for GET/HEAD requests, or in the body for POST requests

Default:array()

$typestringoptional
HTTP request type (use WpOrgRequestsRequests constants)

Default:WpOrgRequestsRequests::GET

$optionsarrayoptional
Options for the request (see WpOrgRequestsRequests::request())

Default:array()

Return

WpOrgRequestsResponse

Source

public function request($url, $headers = [], $data = [], $type = Requests::GET, $options = []) {
	$request = $this->merge_request(compact('url', 'headers', 'data', 'options'));

	return Requests::request($request['url'], $request['headers'], $request['data'], $type, $request['options']);
}

User Contributed Notes

You must log in before being able to contribute a note or feedback.