Main interface for HTTP requests
Description
This method initiates a request and sends it via a transport before parsing.
See also
Parameters
$url
stringrequired- URL to request
$headers
arrayoptional- Extra headers to send with the request
Default:
array()
$data
array|nulloptional- Data to send either as a query string for GET/HEAD requests, or in the body for POST requests
Default:
array()
$type
stringoptional- HTTP request type (use WpOrgRequestsRequests constants)
Default:
WpOrgRequestsRequests::GET
$options
arrayoptional- Options for the request (see WpOrgRequestsRequests::request())
Default:
array()
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.