An adapter class for Zend_Http_Client based on the curl extension.

Curl requires libcurl. See for full requirements the PHP manual: http://php.net/curl

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

 Methods

Adapter constructor

__construct() : void

Config is set using setConfig()

Exceptions

\Zend_Http_Client_Adapter_Exception

Close the connection to the server

close() 
inherited_from \Zend_Http_Client_Adapter_Interface::close()

Initialize curl

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

Parameters

$host

string

$port

integer

$secure

boolean

Exceptions

\Zend_Http_Client_Adapter_Exception if unable to connect

Retrieve the array of all configuration options

getConfig() : array

Returns

array

Get cUrl Handle

getHandle() : resource

Returns

resource

Return read response from server

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

Returns

string

Header reader function for CURL

readHeader(resource $curl, string $header) : integer

Parameters

$curl

resource

$header

string

Returns

integer

Set the configuration array for the adapter

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

Parameters

$config

Exceptions

\Zend_Http_Client_Adapter_Exception

Returns

\Zend_Http_Client_Adapter_Curl

Direct setter for cURL adapter related options.

setCurlOption(string|integer $option, mixed $value) : \Zend_Http_Adapter_Curl

Parameters

$option

stringinteger

$value

mixed

Returns

\Zend_Http_Adapter_Curl

Set output stream for the response

setOutputStream(resource $stream) : \Zend_Http_Client_Adapter_Socket

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

Send request to the remote server

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

Parameters

$method

string

$uri

\Zend_Uri_Http

$httpVersion

$headers

array

$body

string

Exceptions

\Zend_Http_Client_Adapter_Exception If connection fails, connected to wrong host, no PUT file defined, unsupported method, or unsupported cURL option

Returns

string$request

 Properties

 

Parameters array

$_config : array

Default

array()
 

What host/port are we connected to?

$_connected_to : array

Default

array(null, null)
 

The curl session handle

$_curl : resource | null

Default

null
 

List of cURL options that should never be overwritten

$_invalidOverwritableCurlOptions : array

Default

 

Response gotten from server

$_response : string

Default

null
 

Stream for storing output

$out_stream : resource

Default