Documentation

CurlHandle
in package

FinalYes

Implements a cURL connection object

Table of Contents

Constants

CURL_NETWORK_ERRORS  = [\CURLE_COULDNT_RESOLVE_PROXY, \CURLE_COULDNT_RESOLVE_HOST, \CURLE_COULDNT_CONNECT, \CURLE_OPERATION_TIMEOUTED, \CURLE_SSL_CONNECT_ERROR, \CURLE_GOT_NOTHING]
NEVER_OVERWRITE  = [\CURLOPT_CAINFO, \CURLOPT_CAPATH, \CURLOPT_DOH_URL, \CURLOPT_CUSTOMREQUEST, \CURLOPT_HTTPHEADER, \CURLOPT_NOBODY, \CURLOPT_FORBID_REUSE, \CURLOPT_FRESH_CONNECT]

Properties

$curl  : CurlHandle
$curlOptions  : array<string|int, mixed>
$handleID  : int
$initialized  : bool
$options  : HTTPOptions|SettingsContainerInterface
$request  : RequestInterface
$requestBody  : StreamInterface
$response  : ResponseInterface
$responseBody  : StreamInterface

Methods

__construct()  : mixed
CurlHandle constructor.
__destruct()  : mixed
close an existing cURL handle on exit
close()  : self
closes the handle
exec()  : int
executes the current cURL instance and returns the error number
getCurlOptions()  : array<string|int, mixed>
getCurlResource()  : CurlHandle
returns the internal cURL resource in its current state
getError()  : string
returns a string containing the last error
getHandleID()  : int
returns the handle ID (cURL resource id)
getInfo()  : array<string|int, mixed>|null
returns the result from `curl_getinfo()` or `null` in case of an error
getRequest()  : RequestInterface
getResponse()  : ResponseInterface
init()  : CurlHandle|null
guessCA()  : string
Check default locations for the CA bundle
setCA()  : void
setRequestOptions()  : void

Constants

CURL_NETWORK_ERRORS

public mixed CURL_NETWORK_ERRORS = [\CURLE_COULDNT_RESOLVE_PROXY, \CURLE_COULDNT_RESOLVE_HOST, \CURLE_COULDNT_CONNECT, \CURLE_OPERATION_TIMEOUTED, \CURLE_SSL_CONNECT_ERROR, \CURLE_GOT_NOTHING]

NEVER_OVERWRITE

private mixed NEVER_OVERWRITE = [\CURLOPT_CAINFO, \CURLOPT_CAPATH, \CURLOPT_DOH_URL, \CURLOPT_CUSTOMREQUEST, \CURLOPT_HTTPHEADER, \CURLOPT_NOBODY, \CURLOPT_FORBID_REUSE, \CURLOPT_FRESH_CONNECT]

Properties

$curlOptions

private array<string|int, mixed> $curlOptions = []

$requestBody

private StreamInterface $requestBody

$responseBody

private StreamInterface $responseBody

Methods

__construct()

CurlHandle constructor.

public __construct(RequestInterface $request, ResponseInterface $response, HTTPOptions|SettingsContainerInterface $options[, StreamInterface|null $stream = null ]) : mixed
Parameters
$request : RequestInterface
$response : ResponseInterface
$options : HTTPOptions|SettingsContainerInterface
$stream : StreamInterface|null = null

__destruct()

close an existing cURL handle on exit

public __destruct() : mixed

close()

closes the handle

public close() : self
Return values
self

exec()

executes the current cURL instance and returns the error number

public exec() : int
Tags
see
curl_exec()
see
curl_errno()
Return values
int

getCurlOptions()

public getCurlOptions() : array<string|int, mixed>
Tags
codeCoverageIgnore
Return values
array<string|int, mixed>

getCurlResource()

returns the internal cURL resource in its current state

public getCurlResource() : CurlHandle
Tags
codeCoverageIgnore
Return values
CurlHandle

getError()

returns a string containing the last error

public getError() : string
Tags
see
curl_error()
Return values
string

getHandleID()

returns the handle ID (cURL resource id)

public getHandleID() : int
Tags
codeCoverageIgnore
Return values
int

getRequest()

public getRequest() : RequestInterface
Tags
codeCoverageIgnore
Return values
RequestInterface

getResponse()

public getResponse() : ResponseInterface
Tags
codeCoverageIgnore
Return values
ResponseInterface

        
On this page

Search results