[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/SimplePie/src/HTTP/ -> Response.php (summary)

(no description)

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

Defines 1 class

Response:: (9 methods):
  get_permanent_uri()
  get_final_requested_uri()
  get_status_code()
  get_headers()
  has_header()
  get_header()
  with_header()
  get_header_line()
  get_body_content()


Interface: Response  - X-Ref

HTTP Response interface

This interface must be interoperable with Psr\Http\Message\ResponseInterface
get_permanent_uri()   X-Ref
Return the string representation of the permanent URI of the requested resource
(the first location after a prefix of (only) permanent redirects).

Depending on which components of the URI are present, the resulting
string is either a full URI or relative reference according to RFC 3986,
Section 4.1. The method concatenates the various components of the URI,
using the appropriate delimiters:

- If a scheme is present, it MUST be suffixed by ":".
- If an authority is present, it MUST be prefixed by "//".
- The path can be concatenated without delimiters. But there are two
cases where the path has to be adjusted to make the URI reference
valid as PHP does not allow to throw an exception in __toString():
- If the path is rootless and an authority is present, the path MUST
be prefixed by "/".
- If the path is starting with more than one "/" and no authority is
present, the starting slashes MUST be reduced to one.
- If a query is present, it MUST be prefixed by "?".
- If a fragment is present, it MUST be prefixed by "#".


get_final_requested_uri()   X-Ref
Return the string representation of the final requested URL after following all redirects.

Depending on which components of the URI are present, the resulting
string is either a full URI or relative reference according to RFC 3986,
Section 4.1. The method concatenates the various components of the URI,
using the appropriate delimiters:

- If a scheme is present, it MUST be suffixed by ":".
- If an authority is present, it MUST be prefixed by "//".
- The path can be concatenated without delimiters. But there are two
cases where the path has to be adjusted to make the URI reference
valid as PHP does not allow to throw an exception in __toString():
- If the path is rootless and an authority is present, the path MUST
be prefixed by "/".
- If the path is starting with more than one "/" and no authority is
present, the starting slashes MUST be reduced to one.
- If a query is present, it MUST be prefixed by "?".
- If a fragment is present, it MUST be prefixed by "#".


get_status_code()   X-Ref
Gets the response status code.

The status code is a 3-digit integer result code of the server's attempt
to understand and satisfy the request.

return: int Status code.

get_headers()   X-Ref
Retrieves all message header values.

The keys represent the header name as it will be sent over the wire, and
each value is an array of strings associated with the header.

// Represent the headers as a string
foreach ($message->get_headers() as $name => $values) {
echo $name . ': ' . implode(', ', $values);
}

// Emit headers iteratively:
foreach ($message->get_headers() as $name => $values) {
foreach ($values as $value) {
header(sprintf('%s: %s', $name, $value), false);
}
}

return: array<non-empty-array<string>> Returns an associative array of the message's headers.

has_header(string $name)   X-Ref
Checks if a header exists by the given case-insensitive name.

return: bool Returns true if any header names match the given header
param: string $name Case-insensitive header field name.

get_header(string $name)   X-Ref
Retrieves a message header value by the given case-insensitive name.

This method returns an array of all the header values of the given
case-insensitive header name.

If the header does not appear in the message, this method MUST return an
empty array.

return: string[] An array of string values as provided for the given
param: string $name Case-insensitive header field name.

with_header(string $name, $value)   X-Ref
Return an instance with the provided value replacing the specified header.

This method MUST be implemented in such a way as to retain the
immutability of the message, and MUST return an instance that has the
new and/or updated header and value.

return: static
param: string $name Case-insensitive header field name.
param: string|non-empty-array<string> $value Header value(s).

get_header_line(string $name)   X-Ref
Retrieves a comma-separated string of the values for a single header.

This method returns all of the header values of the given
case-insensitive header name as a string concatenated together using
a comma.

NOTE: Not all header values may be appropriately represented using
comma concatenation. For such headers, use getHeader() instead
and supply your own delimiter when concatenating.

If the header does not appear in the message, this method MUST return
an empty string.

return: string A string of values as provided for the given header
param: string $name Case-insensitive header field name.

get_body_content()   X-Ref
get the body as string

return: string



Generated : Wed Sep 17 08:20:04 2025 Cross-referenced by PHPXref