\Guzzle\Http\CurlCurlHandle

Immutable wrapper for a cURL handle

Summary

Methods
Properties
Constants
factory()
__construct()
__destruct()
close()
isAvailable()
getError()
getErrorNo()
setErrorNo()
getInfo()
getStderr()
getUrl()
getHandle()
getOptions()
updateRequestFromTransfer()
parseCurlConfig()
No public properties found
BODY_AS_STRING
PROGRESS
DEBUG
No protected methods found
$options
$handle
$errorNo
N/A
No private methods found
No private properties found
N/A

Constants

BODY_AS_STRING

BODY_AS_STRING = 'body_as_string'

PROGRESS

PROGRESS = 'progress'

DEBUG

DEBUG = 'debug'

Properties

$handle

$handle : resource

Type

resource — Curl resource handle

$errorNo

$errorNo : integer

Type

integer — CURLE_* error

Methods

factory()

factory(\Guzzle\Http\Message\RequestInterface  $request) : \Guzzle\Http\Curl\CurlHandle

Factory method to create a new curl handle based on an HTTP request.

There are some helpful options you can set to enable specific behavior:

  • debug: Set to true to enable cURL debug functionality to track the actual headers sent over the wire.
  • progress: Set to true to enable progress function callbacks.

Parameters

\Guzzle\Http\Message\RequestInterface $request

Request

Throws

\Guzzle\Common\Exception\RuntimeException

Returns

\Guzzle\Http\Curl\CurlHandle

__construct()

__construct(resource  $handle, \Guzzle\Common\Collection|array  $options) 

Construct a new CurlHandle object that wraps a cURL handle

Parameters

resource $handle

Configured cURL handle resource

\Guzzle\Common\Collection|array $options

Curl options to use with the handle

Throws

\Guzzle\Common\Exception\InvalidArgumentException

__destruct()

__destruct() 

Destructor

close()

close() 

Close the curl handle

isAvailable()

isAvailable() : boolean

Check if the handle is available and still OK

Returns

boolean

getError()

getError() : string

Get the last error that occurred on the cURL handle

Returns

string

getErrorNo()

getErrorNo() : integer

Get the last error number that occurred on the cURL handle

Returns

integer

setErrorNo()

setErrorNo(integer  $error) : \Guzzle\Http\Curl\CurlHandle

Set the curl error number

Parameters

integer $error

Error number to set

Returns

\Guzzle\Http\Curl\CurlHandle

getInfo()

getInfo(integer  $option = null) : array|mixed

Get cURL curl_getinfo data

Parameters

integer $option

Option to retrieve. Pass null to retrieve all data as an array.

Returns

array|mixed

getStderr()

getStderr(boolean  $asResource = false) : string|resource|null

Get the stderr output

Parameters

boolean $asResource

Set to TRUE to get an fopen resource

Returns

string|resource|null

getUrl()

getUrl() : \Guzzle\Http\Url

Get the URL that this handle is connecting to

Returns

\Guzzle\Http\Url

getHandle()

getHandle() : resource|null

Get the wrapped curl handle

Returns

resource|null —

Returns the cURL handle or null if it was closed

getOptions()

getOptions() : \Guzzle\Common\Collection

Get the cURL setopt options of the handle. Changing values in the return object will have no effect on the curl handle after it is created.

Returns

\Guzzle\Common\Collection

updateRequestFromTransfer()

updateRequestFromTransfer(\Guzzle\Http\Message\RequestInterface  $request) 

Update a request based on the log messages of the CurlHandle

Parameters

\Guzzle\Http\Message\RequestInterface $request

Request to update

parseCurlConfig()

parseCurlConfig(array|\Guzzle\Common\Collection  $config) : array

Parse the config and replace curl.* configurators into the constant based values so it can be used elsewhere

Parameters

array|\Guzzle\Common\Collection $config

The configuration we want to parse

Returns

array