Class Guzzle\Http\Curl\CurlHandle

InheritanceGuzzle\Http\Curl\CurlHandle

Immutable wrapper for a cURL handle

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$errorNo int CURLE_* error Guzzle\Http\Curl\CurlHandle
$handle resource Curl resource handle Guzzle\Http\Curl\CurlHandle
$options Guzzle\Common\Collection Curl options Guzzle\Http\Curl\CurlHandle

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Construct a new CurlHandle object that wraps a cURL handle Guzzle\Http\Curl\CurlHandle
__destruct() Destructor Guzzle\Http\Curl\CurlHandle
close() Close the curl handle Guzzle\Http\Curl\CurlHandle
factory() Factory method to create a new curl handle based on an HTTP request. Guzzle\Http\Curl\CurlHandle
getError() Get the last error that occurred on the cURL handle Guzzle\Http\Curl\CurlHandle
getErrorNo() Get the last error number that occurred on the cURL handle Guzzle\Http\Curl\CurlHandle
getHandle() Get the wrapped curl handle Guzzle\Http\Curl\CurlHandle
getInfo() Get cURL curl_getinfo data Guzzle\Http\Curl\CurlHandle
getOptions() 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. Guzzle\Http\Curl\CurlHandle
getStderr() Get the stderr output Guzzle\Http\Curl\CurlHandle
getUrl() Get the URL that this handle is connecting to Guzzle\Http\Curl\CurlHandle
isAvailable() Check if the handle is available and still OK Guzzle\Http\Curl\CurlHandle
parseCurlConfig() Parse the config and replace curl.* configurators into the constant based values so it can be used elsewhere Guzzle\Http\Curl\CurlHandle
setErrorNo() Set the curl error number Guzzle\Http\Curl\CurlHandle
updateRequestFromTransfer() Update a request based on the log messages of the CurlHandle Guzzle\Http\Curl\CurlHandle

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
BODY_AS_STRING 'body_as_string' Guzzle\Http\Curl\CurlHandle
DEBUG 'debug' Guzzle\Http\Curl\CurlHandle
PROGRESS 'progress' Guzzle\Http\Curl\CurlHandle

Property Details

$errorNo protected property

CURLE_* error

protected int $errorNo CURLE_OK
$handle protected property

Curl resource handle

protected resource $handle null
$options protected property

Curl options

Method Details

__construct() public method

Construct a new CurlHandle object that wraps a cURL handle

public void __construct ( $handle, $options )
$handle resource

Configured cURL handle resource

$options Guzzle\Common\Collection|array

Curl options to use with the handle

throws Guzzle\Common\Exception\InvalidArgumentException
__destruct() public method

Destructor

public void __destruct ( )
close() public method

Close the curl handle

public void close ( )
factory() public static method

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.
public static Guzzle\Http\Curl\CurlHandle factory ( Guzzle\Http\Message\RequestInterface $request )
$request Guzzle\Http\Message\RequestInterface

Request

throws Guzzle\Common\Exception\RuntimeException
getError() public method

Get the last error that occurred on the cURL handle

public string getError ( )
getErrorNo() public method

Get the last error number that occurred on the cURL handle

public int getErrorNo ( )
getHandle() public method

Get the wrapped curl handle

public resource|null getHandle ( )
return resource|null

Returns the cURL handle or null if it was closed

getInfo() public method

Get cURL curl_getinfo data

public array|mixed getInfo ( $option null )
$option int

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

getOptions() public method

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.

public Guzzle\Common\Collection getOptions ( )
getStderr() public method

Get the stderr output

public string|resource|null getStderr ( $asResource false )
$asResource bool

Set to TRUE to get an fopen resource

getUrl() public method

Get the URL that this handle is connecting to

public Guzzle\Http\Url getUrl ( )
isAvailable() public method

Check if the handle is available and still OK

public bool isAvailable ( )
parseCurlConfig() public static method

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

public static array parseCurlConfig ( $config )
$config array|Guzzle\Common\Collection

The configuration we want to parse

setErrorNo() public method

Set the curl error number

public Guzzle\Http\Curl\CurlHandle setErrorNo ( $error )
$error int

Error number to set

updateRequestFromTransfer() public method

Update a request based on the log messages of the CurlHandle

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

Request to update