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

 Methods

Adapter constructor

__construct() 

Config is set using setOptions()

Exceptions

\Zend\Http\Client\Adapter\Exception\InitializationException

Close the connection to the server

close() 

Initialize curl

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

Parameters

$host

string

$port

int

$secure

bool

Exceptions

\Zend\Http\Client\Adapter\Exception\RuntimeException 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

Returns

string

Header reader function for CURL

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

Parameters

$curl

resource

$header

string

Returns

int

Direct setter for cURL adapter related options.

setCurlOption(string | int $option, mixed $value) : \Zend\Http\Client\Adapter\Curl

Parameters

$option

stringint

$value

mixed

Returns

Set the configuration array for the adapter

setOptions(array | \Traversable $options) : \Zend\Http\Client\Adapter\Curl

Parameters

$options

array\Traversable

Exceptions

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

Returns

Set output stream for the response

setOutputStream(resource $stream) : \Zend\Http\Client\Adapter\Curl

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

Parameters

$stream

resource

Returns

Send request to the remote server

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

Parameters

$method

string

$httpVersion

float

$headers

array

$body

string

Exceptions

\Zend\Http\Client\Adapter\Exception\RuntimeException If connection fails, connected to wrong host, no PUT file defined, unsupported method, or unsupported cURL option
\Zend\Http\Client\Adapter\Exception\InvalidArgumentException if $method is currently not supported

Returns

string$request

 Properties

 

Parameters array

$config : array

 

What host/port are we connected to?

$connectedTo : array

 

The curl session handle

$curl : resource | null

 

List of cURL options that should never be overwritten

$invalidOverwritableCurlOptions : array

 

Stream for storing output

$outputStream : resource

 

Response gotten from server

$response : string