HTTP Proxy-supporting Zend_Http_Client adapter class, based on the default socket based adapter.

Should be used if proxy HTTP access is required. If no proxy is set, will fall back to Zend_Http_Client_Adapter_Socket behavior. Just like the default Socket adapter, this adapter does not require any special extensions installed.

category Zend
package Zend_Http
subpackage Client_Adapter
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() 

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

inherited_from \Zend_Http_Client_Adapter_Socket::__destruct()

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

Will try to connect to the proxy server. If no proxy was set, will fall back to the target server (behave like regular Socket adapter)

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
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 proxy 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

Exceptions

\Zend_Http_Client_Adapter_Exception

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

Preform handshaking with HTTPS proxy using CONNECT method

connectHandshake(string $host, integer $port = 443, string $http_ver = '1.1', array $headers = array()) : void

Parameters

$host

string

$port

integer

$http_ver

string

$headers

array

Exceptions

\Zend_Http_Client_Adapter_Exception

 Properties

 

Stream context

$_context : resource

Default

null
 

Parameters array

$config : array

Default

array('ssltransport' => 'ssl', 'sslcert' => null, 'sslpassphrase' => null, 'sslusecontext' => false, 'proxy_host' => '', 'proxy_port' => 8080, 'proxy_user' => '', 'proxy_pass' => '', 'proxy_auth' => \Zend_Http_Client::AUTH_BASIC, 'persistent' => false)
inherited_from \Zend_Http_Client_Adapter_Socket::config
 

Parameters array

$config : array

Default

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

Stores the last CONNECT handshake request

$connectHandshakeRequest : string

Default

 

What host/port are we connected to?

$connected_to : array

Default

array(null, null)
 

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

$method : string

Default

null
 

Whether HTTPS CONNECT was already negotiated with the proxy or not

$negotiated : boolean

Default

false
 

Stream for storing output

$out_stream : resource

Default

null
 

The socket for server connection

$socket : resource | null

Default

null