A (lazily retrieved) HTTP response.
Methods | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
public
|
getStatusCode(): int
Gets the HTTP status code of the response.
Gets the HTTP status code of the response. Throws
|
# | ||||||||||||
public
|
getHeaders(bool $throw = true): string[][]
Gets the HTTP headers of the response.
Gets the HTTP headers of the response. Parameters
ReturnsThe headers of the response keyed by header names in lowercase Throws
|
# | ||||||||||||
public
|
getContent(bool $throw = true): string
Gets the response body as a string.
Gets the response body as a string. Parameters
Throws
|
# | ||||||||||||
public
|
toArray(bool $throw = true): array
Gets the response body decoded as array, typically from a JSON payload.
Gets the response body decoded as array, typically from a JSON payload. Parameters
Throws
|
# | ||||||||||||
public
|
cancel(): void
Closes the response stream and all related buffers.
Closes the response stream and all related buffers. No further chunk will be yielded after this method has been called. |
# | ||||||||||||
public
|
getInfo(?string $type = null): mixed
Returns info coming from the transport layer.
Returns info coming from the transport layer. This method SHOULD NOT throw any ExceptionInterface and SHOULD be non-blocking. The returned info is "live": it can be empty and can change from one call to another, as the request/response progresses. The following info MUST be returned:
When the "capture_peer_cert_chain" option is true, the "peer_certificate_chain" attribute SHOULD list the peer certificates as an array of OpenSSL X.509 resources. Other info SHOULD be named after curl_getinfo()'s associative return value. ReturnsAn array of all available info, or one of them when $type is provided, or null when an unsupported type is requested |
# |