## Zend_Http_Client_Adapter_Socket

Description

Implements interfaces:

- Zend_Http_Client_Adapter_Interface
- Zend_Http_Client_Adapter_Stream

A sockets based (stream_socket_client) adapter class for Zend_Http_Client. Can be used on almost every PHP environment, and does not require any special extensions.

- copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
- license: New BSD License

Located in /Http/Client/Adapter/Socket.php (line 47)

Direct descendents

Class | Description
--- | ---
Zend_Http_Client_Adapter_Proxy | HTTP Proxy-supporting Zend_Http_Client adapter class, based on the default socket based adapter.
Zend_Gdata_HttpAdapterStreamingSocket | Extends the default HTTP adapter to handle streams instead of discrete body strings.
Zend_Gdata_App_LoggingHttpClientAdapterSocket | 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.

Variable Summary
array $config
array $connected_to
string $method
resource $out_stream
resource|null $socket
resource $_context
Method Summary
Zend_Http_Client_Adapter_Socket __construct ()
void __destruct ()
void close ()
void connect (string $host, [int $port = 80], [boolean $secure = false])
array getConfig ()
resource getStreamContext ()
string read ()
void setConfig ([Zend_Config $config = array()])
Zend_Http_Client_Adapter_Socket setOutputStream (resource $stream)
Zend_Http_Client_Adapter_Socket setStreamContext (mixed $context)
string write (string $method, Zend_Uri_Http $uri, [string $http_ver = '1.1'], [array $headers = array()], [string $body = ''])
void _checkSocketReadTimeout ()
Variables
array $config = array(
'persistent' => false,
'ssltransport' => 'ssl',
'sslcert' => null,
'sslpassphrase' => null,
'sslusecontext' => false
) (line 75)

Parameters array

- access: protected

Redefined in descendants as:

- Zend_Http_Client_Adapter_Proxy::$config : Parameters array

array $connected_to = array(null, null) (line 61)

What host/port are we connected to?

- access: protected

string $method = null (line 88)

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

- access: protected

resource $out_stream = null (line 68)

Stream for storing output

- access: protected

resource|null $socket = null (line 54)

The socket for server connection

- access: protected

resource $_context = null (line 95)

Stream context

- access: protected

Methods
Constructor __construct (line 101)

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

- access: public

Zend_Http_Client_Adapter_Socket __construct ()
Destructor __destruct (line 538)

Destructor: make sure the socket is disconnected

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

- access: public

void __destruct ()

Redefined in descendants as:

- Zend_Http_Client_Adapter_Proxy::__destruct() : Destructor: make sure the socket is disconnected

close (line 491)

Close the connection to the server

- access: public

void close ()

Implementation of:

Zend_Http_Client_Adapter_Interface::close()
  Close the connection to the server

Redefined in descendants as:

- Zend_Http_Client_Adapter_Proxy::close() : Close the connection to the server
- Zend_Gdata_App_LoggingHttpClientAdapterSocket::close() : Close the connection to the server

connect (line 192)

Connect to the remote server

- access: public

void connect (string $host, [int $port = 80], [boolean $secure = false])

- string $host
- int $port
- boolean $secure

Implementation of:

Zend_Http_Client_Adapter_Interface::connect()
  Connect to the remote server

Redefined in descendants as:

- Zend_Http_Client_Adapter_Proxy::connect() : Connect to the remote server
- Zend_Gdata_App_LoggingHttpClientAdapterSocket::connect() : Connect to the remote server

getConfig (line 132)

Retrieve the array of all configuration options

- access: public

array getConfig ()
getStreamContext (line 176)

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

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

- access: public

resource getStreamContext ()
read (line 315)

Read response from server

- access: public

string read ()

Implementation of:

Zend_Http_Client_Adapter_Interface::read()
  Read response from server

Redefined in descendants as:

- Zend_Gdata_App_LoggingHttpClientAdapterSocket::read() : Read response from server

setConfig (line 110)

Set the configuration array for the adapter

- access: public

void setConfig ([Zend_Config $config = array()])

- Zend_Config $config: | array $config

Implementation of:

Zend_Http_Client_Adapter_Interface::setConfig()
  Set the configuration array for the adapter

setOutputStream (line 526)

Set output stream for the response

- access: public

Zend_Http_Client_Adapter_Socket setOutputStream (resource $stream)

- resource $stream

Implementation of:

Zend_Http_Client_Adapter_Stream::setOutputStream()
  Set output stream

setStreamContext (line 150)

Set the stream context for the TCP connection to the server

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
- access: public

Zend_Http_Client_Adapter_Socket setStreamContext (mixed $context)

- mixed $context: Stream context or array of context options

write (line 260)

Send request to the remote server

- return: Request as string
- access: public

string write (string $method, Zend_Uri_Http $uri, [string $http_ver = '1.1'], [array $headers = array()], [string $body = ''])

- string $method
- Zend_Uri_Http $uri
- string $http_ver
- array $headers
- string $body

Implementation of:

Zend_Http_Client_Adapter_Interface::write()
  Send request to the remote server

Redefined in descendants as:

- Zend_Http_Client_Adapter_Proxy::write() : Send request to the proxy server
- Zend_Gdata_HttpAdapterStreamingProxy::write() : Send request to the proxy server with streaming support
- Zend_Gdata_HttpAdapterStreamingSocket::write() : Send request to the remote server with streaming support.
- Zend_Gdata_App_LoggingHttpClientAdapterSocket::write() : Send request to the remote server

_checkSocketReadTimeout (line 504)

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

- throws: Zend_Http_Client_Adapter_Exception with READ_TIMEOUT code
- access: protected

void _checkSocketReadTimeout ()

Documentation generated on Tue, 26 Oct 2010 20:09:13 +0400 by phpDocumentor 1.4.2