WpOrg\Requests

Session::request()publicWP 1.0

Main interface for HTTP requests

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

Метод класса: Session{}

Хуков нет.

Возвращает

\WpOrg\Requests\Response.

Использование

$Session = new Session();
$Session->request( $url, $headers, $data, $type, $options );
$url(строка) (обязательный)
URL to request
$headers(массив)
Extra headers to send with the request
По умолчанию: []
$data(массив|null)
Data to send either as a query string for GET/HEAD requests, or in the body for POST requests
По умолчанию: []
$type(строка)
HTTP request type (use \WpOrg\Requests\Requests constants)
По умолчанию: Requests::GET
$options(массив)
Options for the request (see \WpOrg\Requests\Requests::request())
По умолчанию: []

Заметки

  • Смотрите: \WpOrg\Requests[Requests::request()](/function/Requests::request)

Код Session::request() WP 6.3.1

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']);
}