ParseStreamHttpClient
in package
implements
ParseHttpable
Class ParseStreamHttpClient - Stream http client
Tags
Interfaces, Classes and Traits
- ParseHttpable
- Class ParseHttpable - Interface for an HTTPable client
Table of Contents
- $caFile : string
- Optional CA file to verify our peers with
- $headers : array<string|int, mixed>
- Request Headers
- $httpOptions : array<string|int, mixed>
- Options to pass to the stream context.
- $options : array<string|int, mixed>
- Options to pass to our stream
- $parseStream : ParseStream
- Stream handle
- $responseCode : int
- Response code
- $responseContentType : string|null
- Content type of our response
- $responseHeaders : array<string|int, mixed>
- Response headers
- $streamErrorCode : int
- Stream error code
- $streamErrorMessage : string
- Stream error message
- $timeout : int
- Optional timeout for this request
- __construct() : mixed
- ParseStreamHttpClient constructor.
- addRequestHeader() : mixed
- Adds a header to this request
- formatHeaders() : array<string|int, mixed>
- Converts unformatted headers to an array of headers
- getErrorCode() : int
- Gets the error code
- getErrorMessage() : string
- Gets the error message
- getResponseContentType() : null|string
- Returns the content type of the response
- getResponseHeaders() : array<string|int, mixed>
- Gets headers in the response
- getResponseStatusCode() : int
- Returns the status code of the response
- getStatusCodeFromHeader() : int
- Extracts the Http status code from the given header
- send() : string
- Sends an HTTP request
- setCAFile() : mixed
- Sets the CA file to validate requests with
- setConnectionTimeout() : mixed
- Sets a connection timeout. UNUSED in the stream client.
- setHttpOptions() : mixed
- Sets http options to pass to the stream context https://www.php.net/manual/en/context.php
- setTimeout() : mixed
- Sets the request timeout
- setup() : void
- Sets up ssl related options for the stream context
- buildRequestHeaders() : array<string|int, mixed>
- Builds and returns the coalesced request headers
Properties
$caFile
Optional CA file to verify our peers with
private
string
$caFile
$headers
Request Headers
private
array<string|int, mixed>
$headers
= array()
$httpOptions
Options to pass to the stream context.
private
array<string|int, mixed>
$httpOptions
$options
Options to pass to our stream
private
array<string|int, mixed>
$options
= array()
$parseStream
Stream handle
private
ParseStream
$parseStream
$responseCode
Response code
private
int
$responseCode
= 0
$responseContentType
Content type of our response
private
string|null
$responseContentType
$responseHeaders
Response headers
private
array<string|int, mixed>
$responseHeaders
= array()
$streamErrorCode
Stream error code
private
int
$streamErrorCode
$streamErrorMessage
Stream error message
private
string
$streamErrorMessage
$timeout
Optional timeout for this request
private
int
$timeout
Methods
__construct()
ParseStreamHttpClient constructor.
public
__construct() : mixed
Return values
mixed —addRequestHeader()
Adds a header to this request
public
addRequestHeader(string $key, string $value) : mixed
Parameters
- $key : string
-
Header name
- $value : string
-
Header value
Return values
mixed —formatHeaders()
Converts unformatted headers to an array of headers
public
static formatHeaders(array<string|int, mixed> $rawHeaders) : array<string|int, mixed>
Parameters
- $rawHeaders : array<string|int, mixed>
Return values
array<string|int, mixed> —getErrorCode()
Gets the error code
public
getErrorCode() : int
Return values
int —getErrorMessage()
Gets the error message
public
getErrorMessage() : string
Return values
string —getResponseContentType()
Returns the content type of the response
public
getResponseContentType() : null|string
Return values
null|string —getResponseHeaders()
Gets headers in the response
public
getResponseHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed> —getResponseStatusCode()
Returns the status code of the response
public
getResponseStatusCode() : int
Return values
int —getStatusCodeFromHeader()
Extracts the Http status code from the given header
public
static getStatusCodeFromHeader(string $header) : int
Parameters
- $header : string
Return values
int —send()
Sends an HTTP request
public
send(string $url[, string $method = 'GET' ][, array<string|int, mixed> $data = array() ]) : string
Parameters
- $url : string
-
Url to send this request to
- $method : string = 'GET'
-
Method to send this request via
- $data : array<string|int, mixed> = array()
-
Data to send in this request
Tags
Return values
string —setCAFile()
Sets the CA file to validate requests with
public
setCAFile(string $caFile) : mixed
Parameters
- $caFile : string
-
CA file to set
Return values
mixed —setConnectionTimeout()
Sets a connection timeout. UNUSED in the stream client.
public
setConnectionTimeout(int $timeout) : mixed
Parameters
- $timeout : int
-
Timeout to set
Return values
mixed —setHttpOptions()
Sets http options to pass to the stream context https://www.php.net/manual/en/context.php
public
setHttpOptions(array<string|int, mixed> $httpOptions) : mixed
Parameters
- $httpOptions : array<string|int, mixed>
-
options to set
Return values
mixed —setTimeout()
Sets the request timeout
public
setTimeout(int $timeout) : mixed
Parameters
- $timeout : int
-
Sets the timeout for the request
Return values
mixed —setup()
Sets up ssl related options for the stream context
public
setup() : void
Return values
void —buildRequestHeaders()
Builds and returns the coalesced request headers
private
buildRequestHeaders() : array<string|int, mixed>