Class Curl

Summary

Fully Qualified Name: Zend\Http\Client\Adapter\Curl
Implements: AdapterInterface, StreamInterface

Description

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

Methods

Name Description Defined By
__construct() Adapter constructor Curl
close() Close the connection to the server Curl
connect() Initialize curl Curl
getConfig() Retrieve the array of all configuration options Curl
getHandle() Get cUrl Handle Curl
read() Return read response from server Curl
readHeader() Header reader function for CURL Curl
setCurlOption() Direct setter for cURL adapter related options. Curl
setOptions() Set the configuration array for the adapter Curl
setOutputStream() Set output stream for the response Curl
write() Send request to the remote server Curl

Method Details

__construct()

Adapter constructor

Config is set using setOptions()

Returns:

close()

Close the connection to the server

Returns:

connect()

Initialize curl

Parameter Name Type Description
$host string
$port int
$secure bool

Returns: void

getConfig()

Retrieve the array of all configuration options

Returns: array

getHandle()

Get cUrl Handle

Returns: resource

read()

Return read response from server

Returns: string

readHeader()

Header reader function for CURL

Parameter Name Type Description
$curl resource
$header string

Returns: int

setCurlOption()

Direct setter for cURL adapter related options.

Parameter Name Type Description
$option string|int
$value mixed

Returns: \Curl

setOptions()

Set the configuration array for the adapter

Parameter Name Type Description
$options array|\Traversable

Returns: \Curl

setOutputStream()

Set output stream for the response

Parameter Name Type Description
$stream resource

Returns: \Curl

write()

Send request to the remote server

Parameter Name Type Description
$method string
$uri \Zend\Uri\Uri
$httpVersion float
$headers array
$body string

Returns: string $request

Top