class EventHttpConnection (View source)

EventHttpConnection.

Represents an HTTP connection.

Methods

__construct(EventBase $base, EventDnsBase $dns_base, string $address, int $port, EventSslContext|null $ctx = null)

__construct.

false|EventBase
getBase()

getBase.

void
getPeer(string $address, int $port)

getPeer.

bool
makeRequest(EventHttpRequest $req, int $type, string $uri)

makeRequest.

void
setCloseCallback(callable $callback, mixed $data = null)

setCloseCallback.

void
setLocalAddress(string $address)

setLocalAddress.

void
setLocalPort(int $port)

setLocalPort.

void
setMaxBodySize(string $max_size)

setMaxBodySize.

void
setMaxHeadersSize(string $max_size)

setMaxHeadersSize.

void
setRetries(int $retries)

setRetries.

void
setTimeout(int $timeout)

setTimeout.

Details

__construct(EventBase $base, EventDnsBase $dns_base, string $address, int $port, EventSslContext|null $ctx = null)

__construct.

Constructs EventHttpConnection object.

Parameters

EventBase $base

Associated event base.

EventDnsBase $dns_base

If dns_base is null, hostname resolution will block.

string $address

The address to connect to.

int $port

The port to connect to.

EventSslContext|null $ctx

EventSslContext class object. Enables OpenSSL. This parameter is available only if Event is compiled with OpenSSL support and only with Libevent 2.1.0-alpha and higher.

See also

https://secure.php.net/manual/en/eventhttpconnection.construct.php

false|EventBase getBase()

getBase.

Returns event base associated with the connection.

Return Value

false|EventBase

On success returns EventBase object associated with the connection. Otherwise false.

See also

https://secure.php.net/manual/en/eventhttpconnection.getbase.php

void getPeer(string $address, int $port)

getPeer.

Gets the remote address and port associated with the connection.

Parameters

string $address

Address of the peer.

int $port

Port of the peer.

Return Value

void

See also

https://secure.php.net/manual/en/eventhttpconnection.getpeer.php

bool makeRequest(EventHttpRequest $req, int $type, string $uri)

makeRequest.

Makes an HTTP request over the specified connection.

Parameters

EventHttpRequest $req

The connection object over which to send the request.

int $type

One of EventHttpRequest::CMD_* constants.

string $uri

The URI associated with the request.

Return Value

bool

Returns true on success or false on failure.

See also

https://secure.php.net/manual/en/eventhttpconnection.makerequest.php

void setCloseCallback(callable $callback, mixed $data = null)

setCloseCallback.

Set callback for connection close.

Parameters

callable $callback

Callback which is called when connection is closed. Should match the following prototype: void callback EventHttpConnection conn null mixed arg null

mixed $data (optional)

Return Value

void

See also

https://secure.php.net/manual/en/eventhttpconnection.setclosecallback.php

void setLocalAddress(string $address)

setLocalAddress.

Sets the IP address from which HTTP connections are made.

Parameters

string $address

The IP address from which HTTP connections are made.

Return Value

void

See also

https://secure.php.net/manual/en/eventhttpconnection.setlocaladdress.php

void setLocalPort(int $port)

setLocalPort.

Sets the local port from which connections are made.

Parameters

int $port

The port number.

Return Value

void

See also

https://secure.php.net/manual/en/eventhttpconnection.setlocalport.php

void setMaxBodySize(string $max_size)

setMaxBodySize.

Sets maximum body size for the connection.

Parameters

string $max_size

The maximum body size in bytes.

Return Value

void

See also

https://secure.php.net/manual/en/eventhttpconnection.setmaxbodysize.php

void setMaxHeadersSize(string $max_size)

setMaxHeadersSize.

Sets maximum header size.

Parameters

string $max_size

The maximum header size in bytes.

Return Value

void

See also

https://secure.php.net/manual/en/eventhttpconnection.setmaxheaderssize.php

void setRetries(int $retries)

setRetries.

Sets the retry limit for the connection.

Parameters

int $retries

The retry limit. -1 means infinity.

Return Value

void

See also

https://secure.php.net/manual/en/eventhttpconnection.setretries.php

void setTimeout(int $timeout)

setTimeout.

Sets the timeout for the connection.

Parameters

int $timeout

Timeout in seconds.

Return Value

void

See also

https://secure.php.net/manual/en/eventhttpconnection.settimeout.php