Class CurlHandle
Immutable wrapper for a cURL handle
Methods summary
-
public staticfactory ( Guzzle\Http\Message\RequestInterface $request )Factory method to create a new curl handle based on an HTTP request.
-
public__construct ( resource $handle, Collection|array $options )Construct a new CurlHandle object that wraps a cURL handle
-
public__destruct ( )Destructor
-
publicclose ( )Close the curl handle
-
publicisAvailable ( )Check if the handle is available and still OK
-
publicgetError ( )Get the last error that occurred on the cURL handle
-
publicgetErrorNo ( )Get the last error number that occurred on the cURL handle
-
publicsetErrorNo ( int $error )Set the curl error number
-
publicgetInfo ( int $option = null )Get cURL curl_getinfo data
-
publicgetStderr ( bool $asResource = false )Get the stderr output
-
publicgetUrl ( )Get the URL that this handle is connecting to
-
publicgetHandle ( )Get the wrapped curl handle
-
publicgetOptions ( )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.
-
publicupdateRequestFromTransfer ( Guzzle\Http\Message\RequestInterface $request )Update a request based on the log messages of the CurlHandle
-
public staticparseCurlConfig ( array|Collection $config )Parse the config and replace curl.* configurators into the constant based values so it can be used elsewhere
Methods detail
public static
Guzzle\Http\Curl\CurlHandle
factory( Guzzle\Http\Message\RequestInterface $request )
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
- $request
Guzzle\Http\Message\RequestInterface
$request Request
Returns
Throws
Construct a new CurlHandle object that wraps a cURL handle
Parameters
- $handle
resource
$handle Configured cURL handle resource- $options
Guzzle\Common\Collection|array
$options Curl options to use with the handle
Throws
Destructor
Close the curl handle
Check if the handle is available and still OK
Returns
booleanGet the last error that occurred on the cURL handle
Returns
stringGet the last error number that occurred on the cURL handle
Returns
integerSet the curl error number
Parameters
- $error
integer
$error Error number to set
Returns
Get cURL curl_getinfo data
Parameters
- $option
integer
$option Option to retrieve. Pass null to retrieve all data as an array.
Returns
array|mixedGet the stderr output
Parameters
- $asResource
boolean
$asResource Set to TRUE to get an fopen resource
Returns
string|resource|nullGet the wrapped curl handle
Returns
resource|nullReturns the cURL handle or null if it was closed
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
Update a request based on the log messages of the CurlHandle
Parameters
- $request
Guzzle\Http\Message\RequestInterface
$request Request to update
Parse the config and replace curl.* configurators into the constant based values so it can be used elsewhere
Parameters
- $config
array|Guzzle\Common\Collection
$config The configuration we want to parse
Returns
arrayMagic methods summary
Constants summary
string |
BODY_AS_STRING |
'body_as_string' |
|
string |
PROGRESS |
'progress' |
|
string |
DEBUG |
'debug' |
Properties summary
protected
|
$options |
#
Curl options |
protected
resource
|
$handle |
#
Curl resource handle |
protected
integer
|
$errorNo |
#
CURLE_* error |