Overrides the traditional socket-based adapter class for Zend_Http_Client to enable logging of requests. All requests are logged to a location specified in the config as $config['logfile']. Requests and responses are logged after they are sent and received/processed, thus an error could prevent logging.

category Zend
package Zend_Gdata
subpackage App
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Http_Client_Adapter_Socket

 Methods

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

__construct() 
Inherited

Destructor: make sure the socket is disconnected

__destruct() 
Inherited

If we are in persistent TCP mode, will not close the connection

Close the connection to the server

close() 
inherited_from \Zend_Http_Client_Adapter_Socket::close()

Close the connection to the server

close() 
Inherited
inherited_from \Zend_Http_Client_Adapter_Interface::close()

Connect to the remote server

connect(string $host, integer $port = 80, boolean $secure = false
inherited_from \Zend_Http_Client_Adapter_Socket::connect()

Parameters

$host

string

$port

integer

$secure

boolean

Connect to the remote server

connect(string $host, integer $port = 80, boolean $secure = false
Inherited
inherited_from \Zend_Http_Client_Adapter_Interface::connect()

Parameters

$host

string

$port

integer

$secure

boolean

Retrieve the array of all configuration options

getConfig() : array
Inherited

Returns

array

Get the stream context for the TCP connection to the server.

getStreamContext() : resource
Inherited

If no stream context is set, will create a default one.

Returns

resource

Read response from server

read() : string
inherited_from \Zend_Http_Client_Adapter_Socket::read()

Returns

string

Read response from server

read() : string
Inherited
inherited_from \Zend_Http_Client_Adapter_Interface::read()

Returns

string

Set the configuration array for the adapter

setConfig(array $config = array()
Inherited
inherited_from \Zend_Http_Client_Adapter_Interface::setConfig()

Parameters

$config

Set output stream for the response

setOutputStream(resource $stream) : \Zend_Http_Client_Adapter_Socket
Inherited

This function sets output stream where the result will be stored.

inherited_from \Zend_Http_Client_Adapter_Stream::setOutputStream()

Parameters

$stream

resource

Returns

\Zend_Http_Client_Adapter_Socket

Set the stream context for the TCP connection to the server

setStreamContext(mixed $context) : \Zend_Http_Client_Adapter_Socket
Inherited

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.

since Zend Framework 1.9

Parameters

$context

mixed

Stream context or array of context options

Returns

\Zend_Http_Client_Adapter_Socket

Send request to the remote server

write(string $method, \Zend_Uri_Http $uri, string $http_ver = '1.1', array $headers = array(), string $body = '') : string
inherited_from \Zend_Http_Client_Adapter_Socket::write()

Parameters

$method

string

$uri

\Zend_Uri_Http

$http_ver

string

$headers

array

$body

string

Returns

stringRequest as string

Send request to the remote server

write(string $method, \Zend_Uri_Http $uri, string $http_ver = '1.1', array $headers = array(), string $body = '') : string
Inherited
inherited_from \Zend_Http_Client_Adapter_Interface::write()

Parameters

$method

string

$uri

\Zend_Uri_Http

$http_ver

string

$headers

array

$body

string

Returns

stringRequest as string

Check if the socket has timed out - if so close connection and throw an exception

_checkSocketReadTimeout() 
Inherited

Exceptions

\Zend_Http_Client_Adapter_Exception with READ_TIMEOUT code

Log the given message to the log file. The log file is configured as the config param 'logfile'. This method opens the file for writing if necessary.

log(string $message) 

Parameters

$message

string

The message to log

 Properties

 

Stream context

$_context : resource

Default

null
 

Parameters array

$config : array

Default

array('persistent' => false, 'ssltransport' => 'ssl', 'sslcert' => null, 'sslpassphrase' => null, 'sslusecontext' => false)
 

What host/port are we connected to?

$connected_to : array

Default

array(null, null)
 

The file handle for writing logs

$log_handle : resource | null

Default

null
 

Request method - will be set by write() and might be used by read()

$method : string

Default

null
 

Stream for storing output

$out_stream : resource

Default

null
 

The socket for server connection

$socket : resource | null

Default

null