Documentation

CurlHandle
in package

FinalYes

Implements a cURL connection object

Table of Contents

Constants

CURL_NETWORK_ERRORS  : array<string|int, mixed> = [\CURLE_COULDNT_RESOLVE_PROXY, \CURLE_COULDNT_R...
NEVER_OVERWRITE  : array<string|int, mixed> = [\CURLOPT_CAINFO, \CURLOPT_CAPATH, \CURLOPT_CAI...

Properties

$curl  : CurlHandle|null
$id  : int
$request  : RequestInterface
$curlOptions  : array<int, mixed>
$initialized  : bool
$options  : HTTPOptions|SettingsContainerInterface
$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>
getError()  : string
returns a string containing the last error
getInfo()  : array<string|int, mixed>|null
returns the result from `curl_getinfo()` or `null` in case of an error
getResponse()  : ResponseInterface
init()  : CurlHandle|null
guessCA()  : string
Check default locations for the CA bundle
setCA()  : void
setRequestOptions()  : void

Constants

CURL_NETWORK_ERRORS

public array<string|int, 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

public array<string|int, mixed> NEVER_OVERWRITE = [\CURLOPT_CAINFO, \CURLOPT_CAPATH, \CURLOPT_CAINFO_BLOB, \CURLOPT_CUSTOMREQUEST, \CURLOPT_DOH_URL, \CURLOPT_FORBID_REUSE, \CURLOPT_FRESH_CONNECT, \CURLOPT_HTTPHEADER, \CURLOPT_NOBODY, \CURLOPT_USERAGENT]

Properties

$request

public private(set) RequestInterface $request

$curlOptions

private array<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()
curl_errno()
Return values
int

getCurlOptions()

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

getError()

returns a string containing the last error

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

getResponse()

public getResponse() : ResponseInterface
Tags
codeCoverageIgnore
Return values
ResponseInterface
On this page

Search results