Parser
in package
HTTP response parser class
Tags
Table of Contents
Constants
- BASE64 = 'BASE64'
- Encoding constants
- DEFLATE = 'DEFLATE'
- GZIP = 'GZIP'
- QUOTED = 'QUOTED'
- RAW_URL = 'RAW_URL'
- URL = 'URL'
Methods
- decodeChunkedData() : string
- Decode a chunked transfer-encoded data and return the decoded data
- decodeData() : string
- Decode data
- encodeData() : string
- Encode data
- parseDataByContentType() : mixed
- Parse request or response data based on content type
- parseHeaders() : array<string|int, mixed>
- Parse headers
- parseResponseFromString() : Response
- Parse a response from a full response string
- parseResponseFromUri() : Response
- Parse a response from a URI
Constants
BASE64
Encoding constants
public
string
BASE64
= 'BASE64'
DEFLATE
public
mixed
DEFLATE
= 'DEFLATE'
GZIP
public
mixed
GZIP
= 'GZIP'
QUOTED
public
mixed
QUOTED
= 'QUOTED'
RAW_URL
public
mixed
RAW_URL
= 'RAW_URL'
URL
public
mixed
URL
= 'URL'
Methods
decodeChunkedData()
Decode a chunked transfer-encoded data and return the decoded data
public
static decodeChunkedData(string $data) : string
Parameters
- $data : string
Return values
stringdecodeData()
Decode data
public
static decodeData(string $data[, string|null $encoding = null ][, bool $chunked = false ]) : string
Parameters
- $data : string
- $encoding : string|null = null
- $chunked : bool = false
Return values
stringencodeData()
Encode data
public
static encodeData(string $data[, string|null $encoding = null ]) : string
Parameters
- $data : string
- $encoding : string|null = null
Return values
stringparseDataByContentType()
Parse request or response data based on content type
public
static parseDataByContentType(string $rawData[, string|null $contentType = null ][, string|null $encoding = null ][, bool $chunked = false ]) : mixed
Parameters
- $rawData : string
- $contentType : string|null = null
- $encoding : string|null = null
- $chunked : bool = false
parseHeaders()
Parse headers
public
static parseHeaders(mixed $headers) : array<string|int, mixed>
Parameters
- $headers : mixed
Return values
array<string|int, mixed>parseResponseFromString()
Parse a response from a full response string
public
static parseResponseFromString(string $responseString) : Response
Parameters
- $responseString : string
Return values
ResponseparseResponseFromUri()
Parse a response from a URI
public
static parseResponseFromUri(string $uri[, string $method = 'GET' ][, string $mode = 'r' ][, array<string|int, mixed> $options = [] ][, array<string|int, mixed> $params = [] ]) : Response
Parameters
- $uri : string
- $method : string = 'GET'
- $mode : string = 'r'
- $options : array<string|int, mixed> = []
- $params : array<string|int, mixed> = []