WpOrg\Requests
Session::request()
Main interface for HTTP requests
This method initiates a request and sends it via a transport before parsing.
Method of the class: Session{}
No Hooks.
Return
\WpOrg\Requests\Response
.
Usage
$Session = new Session(); $Session->request( $url, $headers, $data, $type, $options );
- $url(string) (required)
- URL to request
- $headers(array)
- Extra headers to send with the request
Default: [] - $data(array|null)
- Data to send either as a query string for GET/HEAD requests, or in the body for POST requests
Default: [] - $type(string)
- HTTP request type (use \WpOrg\Requests\Requests constants)
Default: Requests::GET - $options(array)
- Options for the request (see \WpOrg\Requests\Requests::request())
Default: []
Notes
- See: \WpOrg\Requests[Requests::request()](/function/Requests::request)
Session::request() Session::request code WP 6.6.2
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']); }