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

 Methods

Adapter constructor, currently empty.

__construct() 
Inherited

Config is set using setOptions()

inherited_from \Zend\Http\Client\Adapter\Socket::__construct()

Destructor: make sure the socket is disconnected

__destruct() 

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

Close the connection to the server

close() 

Connect to the remote server

connect(string $host, int $port, bool $secure) 

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)

Parameters

$host

string

$port

int

$secure

bool

Exceptions

\Zend\Http\Client\Adapter\Exception\RuntimeException

Retrieve the array of all configuration options

getConfig() : array
Inherited

inherited_from \Zend\Http\Client\Adapter\Socket::getConfig()

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.

inherited_from \Zend\Http\Client\Adapter\Socket::getStreamContext()

Returns

resource

Read response from server

read() : string
Inherited

inherited_from \Zend\Http\Client\Adapter\Socket::read()

Exceptions

\Zend\Http\Client\Adapter\Exception\RuntimeException

Returns

string

Set the configuration array for the adapter

setOptions(array $options) 

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\Socket::setOutputStream()

Parameters

$stream

resource

Returns

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
inherited_from \Zend\Http\Client\Adapter\Socket::setStreamContext()

Parameters

$context

mixed

Stream context or array of context options

Exceptions

\Zend\Http\Client\Adapter\Exception\InvalidArgumentException

Returns

Send request to the proxy server

write(string $method, \Zend\Uri\Uri $uri, string $httpVer, array $headers, string $body) : string

Parameters

$method

string

$httpVer

string

$headers

array

$body

string

Exceptions

\Zend\Http\Client\Adapter\Exception\RuntimeException

Returns

stringRequest as string

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

_checkSocketReadTimeout() 
Inherited

inherited_from \Zend\Http\Client\Adapter\Socket::_checkSocketReadTimeout()

Exceptions

\Zend\Http\Client\Adapter\Exception\TimeoutException with READ_TIMEOUT code

Preform handshaking with HTTPS proxy using CONNECT method

connectHandshake(string $host, integer $port, string $httpVer, array $headers) 

Parameters

$host

string

$port

integer

$httpVer

string

$headers

array

Exceptions

\Zend\Http\Client\Adapter\Exception\RuntimeException

 Properties

 

Parameters array

$config : array

 

What host/port are we connected to?

$connectedTo : array
Inherited

inherited_from \Zend\Http\Client\Adapter\Socket::$$connectedTo
 

Stream context

$context : resource
Inherited

inherited_from \Zend\Http\Client\Adapter\Socket::$$context
 

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

$method : string
Inherited

inherited_from \Zend\Http\Client\Adapter\Socket::$$method
 

Whether HTTPS CONNECT was already negotiated with the proxy or not

$negotiated : bool

 

Stream for storing output

$outStream : resource
Inherited

inherited_from \Zend\Http\Client\Adapter\Socket::$$outStream
 

The socket for server connection

$socket : resource | null
Inherited

inherited_from \Zend\Http\Client\Adapter\Socket::$$socket
 

Map SSL transport wrappers to stream crypto method constants

$sslCryptoTypes : array
Inherited

inherited_from \Zend\Http\Client\Adapter\Socket::$$sslCryptoTypes