Documentation

Core_Http_Socket extends Core_Http
in package

Http socket driver

Tags
subpackage

Core\Http

version
7.x
author

Hostmake LLC

copyright

© 2005-2022 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru

Table of Contents

$_additionalHeaders  : array<string|int, mixed>
Additional headers
$_body  : string
Body of the request
$_config  : array<string|int, mixed>
Additional parameters
$_contentType  : string
Request Content-type
$_data  : array<string|int, mixed>
Additional data of the request
$_errno  : int
Error number
$_error  : string|null
Error message
$_headers  : string
Headers of the request
$_method  : string
Request method
$_originalConfig  : mixed
Original Config
$_port  : int
Request port
$_rawData  : string
Request Raw Data
$_referer  : string
Request referer
$_timeout  : string
Request time out
$_url  : string
Request URL
$_userAgent  : string
Request User-Agent
__construct()  : mixed
Constructor.
additionalHeader()  : self
Add additional headers
addOption()  : self
Add option
clear()  : self
Clear object
config()  : self
Set additional parameters
contentType()  : self
Set Content-type
data()  : self
Additional POST data
execute()  : mixed
Executes the business logic.
generateUserAgent()  : string
Get random User Agent
getBody()  : string
Get body
getConfig()  : array<string|int, mixed>
Get config
getDecompressedBody()  : string
Get decompressed body
getErrno()  : int
Get Error number
getError()  : string|null
Get Error message
getHeaders()  : string
Get headers
getOs()  : string
Get random OS for $browser and $version
getUrl()  : string
Get URL
instance()  : object
Register an existing instance as a singleton.
method()  : self
Set HTTP method
parseHeaders()  : array<string|int, mixed>
Parse header
parseHttpStatusCode()  : int
Parse HTTP status code
port()  : self
Set port
rawData()  : self
Set Raw request data
referer()  : self
Set HTTP referer
timeout()  : self
Set timeout
url()  : self
Set URL
userAgent()  : self
Set HTTP User-Agent
_execute()  : self
Send request
_explode()  : self
Explode Headers and Body
_getDriverName()  : string
Get full driver name
_init()  : self
Initialize object
_parseHeaders()  : array<string|int, mixed>
Parse header
_parseHeadersCallback()  : string
Parse header callback

Properties

$_additionalHeaders

Additional headers

protected array<string|int, mixed> $_additionalHeaders = array()

$_body

Body of the request

protected string $_body = \NULL

$_config

Additional parameters

protected array<string|int, mixed> $_config = array()

$_contentType

Request Content-type

protected string $_contentType = \NULL

$_data

Additional data of the request

protected array<string|int, mixed> $_data = array()

$_errno

Error number

protected int $_errno = 0

$_error

Error message

protected string|null $_error = \NULL

$_headers

Headers of the request

protected string $_headers = \NULL

$_method

Request method

protected string $_method = \NULL

$_originalConfig

Original Config

protected mixed $_originalConfig = \NULL

$_port

Request port

protected int $_port = \NULL

$_rawData

Request Raw Data

protected string $_rawData = \NULL

$_referer

Request referer

protected string $_referer = \NULL

$_timeout

Request time out

protected string $_timeout = \NULL

$_url

Request URL

protected string $_url = \NULL

$_userAgent

Request User-Agent

protected string $_userAgent = \NULL

Methods

__construct()

Constructor.

public __construct(mixed $config) : mixed
Parameters
$config : mixed
Return values
mixed

additionalHeader()

Add additional headers

public additionalHeader(string $name, string $value) : self
Parameters
$name : string

Header Name

$value : string

Value

Return values
self

addOption()

Add option

public addOption(string $name, string $value) : self
Parameters
$name : string

Header name

$value : string

Value

Return values
self

clear()

Clear object

public clear() : self
Return values
self

config()

Set additional parameters

public config(array<string|int, mixed> $array) : self
Parameters
$array : array<string|int, mixed>

params

Return values
self

contentType()

Set Content-type

public contentType(string $contentType) : self
Parameters
$contentType : string

content type

Return values
self

data()

Additional POST data

public data(string $key, string $value) : self
Parameters
$key : string

key

$value : string

value

Return values
self

execute()

Executes the business logic.

public execute() : mixed
Return values
mixed

generateUserAgent()

Get random User Agent

public static generateUserAgent([string|null $browser = NULL ]) : string
Parameters
$browser : string|null = NULL

'chrome' or 'firefox', random if NULL

Return values
string

getBody()

Get body

public getBody() : string
Return values
string

getConfig()

Get config

public getConfig() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDecompressedBody()

Get decompressed body

public getDecompressedBody() : string
Return values
string

getErrno()

Get Error number

public getErrno() : int
Return values
int

getError()

Get Error message

public getError() : string|null
Return values
string|null

getHeaders()

Get headers

public getHeaders() : string
Return values
string

getOs()

Get random OS for $browser and $version

public static getOs(string $browser[, string $version = NULL ]) : string
Parameters
$browser : string
$version : string = NULL
Return values
string

getUrl()

Get URL

public getUrl() : string
Return values
string

URL

instance()

Register an existing instance as a singleton.

public static instance([string $name = 'default' ]) : object
Parameters
$name : string = 'default'
Return values
object

method()

Set HTTP method

public method(string $method) : self
Parameters
$method : string

method

Return values
self

parseHeaders()

Parse header

public parseHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>

parseHttpStatusCode()

Parse HTTP status code

public parseHttpStatusCode(string $status) : int
Parameters
$status : string

status code, e.g. 'HTTP/1.1 200 OK'

Return values
int

port()

Set port

public port(string $port) : self
Parameters
$port : string

port

Return values
self

rawData()

Set Raw request data

public rawData(string $data) : self
Parameters
$data : string

Raw data

Return values
self

referer()

Set HTTP referer

public referer(string $referer) : self
Parameters
$referer : string

referer

Return values
self

timeout()

Set timeout

public timeout(string $timeout) : self
Parameters
$timeout : string

timeout

Return values
self

url()

Set URL

public url(string $url) : self
Parameters
$url : string

URL

Return values
self

userAgent()

Set HTTP User-Agent

public userAgent(string $userAgent) : self
Parameters
$userAgent : string

User-Agent

Return values
self

_execute()

Send request

protected _execute(string $host, string $path, string $query[, mixed $scheme = 'http' ]) : self
Parameters
$host : string

host

$path : string

path

$query : string

query

$scheme : mixed = 'http'
Return values
self

_explode()

Explode Headers and Body

protected _explode() : self
Return values
self

_getDriverName()

Get full driver name

protected static _getDriverName(string $driver) : string
Parameters
$driver : string

driver name

Return values
string

_init()

Initialize object

protected _init() : self
Return values
self

_parseHeaders()

Parse header

protected _parseHeaders(string $header) : array<string|int, mixed>
Parameters
$header : string
Return values
array<string|int, mixed>

_parseHeadersCallback()

Parse header callback

protected _parseHeadersCallback(array<string|int, mixed> $matches) : string
Parameters
$matches : array<string|int, mixed>
Return values
string

Search results