[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/Requests/src/ -> Session.php (summary)

Session handler for persistent requests and default parameters

File Size: 308 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Session:: (15 methods):
  __construct()
  __get()
  __set()
  __isset()
  __unset()
  get()
  head()
  delete()
  post()
  put()
  patch()
  request()
  request_multiple()
  __wakeup()
  merge_request()


Class: Session  - X-Ref

Session handler for persistent requests and default parameters

Allows various options to be set as default values, and merges both the
options and URL properties together. A base URL can be set for all requests,
with all subrequests resolved from this. Base options can be set (including
a shared cookie jar), then overridden for individual requests.

__construct($url = null, $headers = [], $data = [], $options = [])   X-Ref
Create a new session

param: string|Stringable|null $url Base URL for requests
param: array $headers Default headers for requests
param: array $data Default data for requests
param: array $options Default options for requests

__get($name)   X-Ref
Get a property's value

return: mixed|null Property value, null if none found
param: string $name Property name.

__set($name, $value)   X-Ref
Set a property's value

param: string $name Property name.
param: mixed $value Property value

__isset($name)   X-Ref
Remove a property's value

param: string $name Property name.

__unset($name)   X-Ref
Remove a property's value

param: string $name Property name.

get($url, $headers = [], $options = [])   X-Ref
Send a GET request


head($url, $headers = [], $options = [])   X-Ref
Send a HEAD request


delete($url, $headers = [], $options = [])   X-Ref
Send a DELETE request


post($url, $headers = [], $data = [], $options = [])   X-Ref
Send a POST request


put($url, $headers = [], $data = [], $options = [])   X-Ref
Send a PUT request


patch($url, $headers, $data = [], $options = [])   X-Ref
Send a PATCH request

Note: Unlike {@see \WpOrg\Requests\Session::post()} and {@see \WpOrg\Requests\Session::put()},
`$headers` is required, as the specification recommends that should send an ETag


request($url, $headers = [], $data = [], $type = Requests::GET, $options = [])   X-Ref
Main interface for HTTP requests

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

return: \WpOrg\Requests\Response
param: string $url URL to request
param: array $headers Extra headers to send with the request
param: array|null $data Data to send either as a query string for GET/HEAD requests, or in the body for POST requests
param: string $type HTTP request type (use \WpOrg\Requests\Requests constants)
param: array $options Options for the request (see {@see \WpOrg\Requests\Requests::request()})

request_multiple($requests, $options = [])   X-Ref
Send multiple HTTP requests simultaneously

return: array Responses (either \WpOrg\Requests\Response or a \WpOrg\Requests\Exception object)
param: array $requests Requests data (see {@see \WpOrg\Requests\Requests::request_multiple()})
param: array $options Global and default options (see {@see \WpOrg\Requests\Requests::request()})

__wakeup()   X-Ref
No description

merge_request($request, $merge_options = true)   X-Ref
Merge a request's data with the default data

return: array Request data
param: array $request Request data (same form as {@see \WpOrg\Requests\Session::request_multiple()})
param: boolean $merge_options Should we merge options as well?



Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref