PHP Class Zend_Http_Client_Adapter_Socket

Inheritance: implements Zend_Http_Client_Adapter_Interface, implements Zend_Http_Client_Adapter_Stream
Afficher le fichier Open project: dbpatch/dbpatch Class Usage Examples

Protected Properties

Свойство Type Description
$_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

Méthodes publiques

Méthode Description
__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

Méthodes protégées

Méthode Description
_checkSocketReadTimeout ( ) Check if the socket has timed out - if so close connection and throw an exception

Method Details

__construct() public méthode

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

__destruct() public méthode

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

_checkSocketReadTimeout() protected méthode

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

close() public méthode

Close the connection to the server
public close ( )

connect() public méthode

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

getConfig() public méthode

Retrieve the array of all configuration options
public getConfig ( ) : array
Résultat array

getStreamContext() public méthode

If no stream context is set, will create a default one.
public getStreamContext ( ) : resource
Résultat resource

read() public méthode

Read response from server
public read ( ) : string
Résultat string

setConfig() public méthode

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

setOutputStream() public méthode

Set output stream for the response
public setOutputStream ( resource $stream ) : Zend_Http_Client_Adapter_Socket
$stream resource
Résultat Zend_Http_Client_Adapter_Socket

setStreamContext() public méthode

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
Résultat Zend_Http_Client_Adapter_Socket

write() public méthode

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
Résultat string Request as string

Property Details

$_context protected_oe property

Stream context
protected resource $_context
Résultat resource

$config protected_oe property

Parameters array
protected array $config
Résultat array

$connected_to protected_oe property

What host/port are we connected to?
protected array $connected_to
Résultat array

$method protected_oe property

Request method - will be set by write() and might be used by read()
protected string $method
Résultat string

$out_stream protected_oe property

Stream for storing output
protected resource $out_stream
Résultat resource

$socket protected_oe property

The socket for server connection
protected resource|null $socket
Résultat resource | null