[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/ -> class-wp-http-response.php (summary)

HTTP API: WP_HTTP_Response class

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

Defines 1 class

WP_HTTP_Response:: (9 methods):
  __construct()
  get_headers()
  set_headers()
  header()
  get_status()
  set_status()
  get_data()
  set_data()
  jsonSerialize()


Class: WP_HTTP_Response  - X-Ref

Core class used to prepare HTTP responses.

__construct( $data = null, $status = 200, $headers = array()   X-Ref
Constructor.

since: 4.4.0
param: mixed $data    Response data. Default null.
param: int   $status  Optional. HTTP status code. Default 200.
param: array $headers Optional. HTTP header map. Default empty array.

get_headers()   X-Ref
Retrieves headers associated with the response.

since: 4.4.0
return: array Map of header name to header value.

set_headers( $headers )   X-Ref
Sets all header values.

since: 4.4.0
param: array $headers Map of header name to header value.

header( $key, $value, $replace = true )   X-Ref
Sets a single HTTP header.

since: 4.4.0
param: string $key     Header name.
param: string $value   Header value.
param: bool   $replace Optional. Whether to replace an existing header of the same name.

get_status()   X-Ref
Retrieves the HTTP return code for the response.

since: 4.4.0
return: int The 3-digit HTTP status code.

set_status( $code )   X-Ref
Sets the 3-digit HTTP status code.

since: 4.4.0
param: int $code HTTP status.

get_data()   X-Ref
Retrieves the response data.

since: 4.4.0
return: mixed Response data.

set_data( $data )   X-Ref
Sets the response data.

since: 4.4.0
param: mixed $data Response data.

jsonSerialize()   X-Ref
Retrieves the response data for JSON serialization.

It is expected that in most implementations, this will return the same as get_data(),
however this may be different if you want to do custom JSON data handling.

since: 4.4.0
return: mixed Any JSON-serializable value.



Generated: Fri Mar 29 01:00:02 2024 Cross-referenced by PHPXref 0.7.1