PHP Класс Zend_Http_Client_Adapter_Socket

Наследование: implements Zend_Http_Client_Adapter_Interface, implements Zend_Http_Client_Adapter_Stream
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_context resource Stream context
$config array Parameters array
$connected_to array What host/port are we connected to?
$method string Request method - will be set by write() and might be used by read()
$out_stream resource Stream for storing output
$socket resource | null The socket for server connection

Открытые методы

Метод Описание
__construct ( ) Adapter constructor, currently empty. Config is set using setConfig()
__destruct ( ) Destructor: make sure the socket is disconnected
close ( ) Close the connection to the server
connect ( string $host, integer $port = 80, boolean $secure = false ) Connect to the remote server
getConfig ( ) : array Retrieve the array of all configuration options
getStreamContext ( ) : resource Get the stream context for the TCP connection to the server.
read ( ) : string Read response from server
setConfig ( $config = [] ) Set the configuration array for the adapter
setOutputStream ( resource $stream ) : Zend_Http_Client_Adapter_Socket Set output stream for the response
setStreamContext ( mixed $context ) : Zend_Http_Client_Adapter_Socket Set the stream context for the TCP connection to the server
write ( string $method, Zend_Uri_Http $uri, string $http_ver = '1.1', array $headers = [], string $body = '' ) : string Send request to the remote server

Защищенные методы

Метод Описание
_checkSocketReadTimeout ( ) Check if the socket has timed out - if so close connection and throw an exception

Описание методов

__construct() публичный Метод

Adapter constructor, currently empty. Config is set using setConfig()
public __construct ( )

__destruct() публичный Метод

If we are in persistent TCP mode, will not close the connection
public __destruct ( )

_checkSocketReadTimeout() защищенный Метод

Check if the socket has timed out - if so close connection and throw an exception
protected _checkSocketReadTimeout ( )

close() публичный Метод

Close the connection to the server
public close ( )

connect() публичный Метод

Connect to the remote server
public connect ( string $host, integer $port = 80, boolean $secure = false )
$host string
$port integer
$secure boolean

getConfig() публичный Метод

Retrieve the array of all configuration options
public getConfig ( ) : array
Результат array

getStreamContext() публичный Метод

If no stream context is set, will create a default one.
public getStreamContext ( ) : resource
Результат resource

read() публичный Метод

Read response from server
public read ( ) : string
Результат string

setConfig() публичный Метод

Set the configuration array for the adapter
public setConfig ( $config = [] )

setOutputStream() публичный Метод

Set output stream for the response
public setOutputStream ( resource $stream ) : Zend_Http_Client_Adapter_Socket
$stream resource
Результат Zend_Http_Client_Adapter_Socket

setStreamContext() публичный Метод

Can accept either a pre-existing stream context resource, or an array of stream options, similar to the options array passed to the stream_context_create() PHP function. In such case a new stream context will be created using the passed options.
public setStreamContext ( mixed $context ) : Zend_Http_Client_Adapter_Socket
$context mixed Stream context or array of context options
Результат Zend_Http_Client_Adapter_Socket

write() публичный Метод

Send request to the remote server
public write ( string $method, Zend_Uri_Http $uri, string $http_ver = '1.1', array $headers = [], string $body = '' ) : string
$method string
$uri Zend_Uri_Http
$http_ver string
$headers array
$body string
Результат string Request as string

Описание свойств

$_context защищенное свойство

Stream context
protected resource $_context
Результат resource

$config защищенное свойство

Parameters array
protected array $config
Результат array

$connected_to защищенное свойство

What host/port are we connected to?
protected array $connected_to
Результат array

$method защищенное свойство

Request method - will be set by write() and might be used by read()
protected string $method
Результат string

$out_stream защищенное свойство

Stream for storing output
protected resource $out_stream
Результат resource

$socket защищенное свойство

The socket for server connection
protected resource|null $socket
Результат resource | null