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
$curl
public private(set)
CurlHandle|null
$curl
$id read-only
public
int
$id
$request
public private(set)
RequestInterface
$request
$curlOptions
private
array<int, mixed>
$curlOptions
= []
$initialized
private
bool
$initialized
= false
$options
private
HTTPOptions|SettingsContainerInterface
$options
$requestBody
private
StreamInterface
$requestBody
$response
private
ResponseInterface
$response
$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
selfexec()
executes the current cURL instance and returns the error number
public
exec() : int
Tags
Return values
intgetCurlOptions()
public
getCurlOptions() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getError()
returns a string containing the last error
public
getError() : string
Tags
Return values
stringgetInfo()
returns the result from `curl_getinfo()` or `null` in case of an error
public
getInfo() : array<string|int, mixed>|null
Tags
Return values
array<string|int, mixed>|nullgetResponse()
public
getResponse() : ResponseInterface
Tags
Return values
ResponseInterfaceinit()
public
init() : CurlHandle|null
Tags
Return values
CurlHandle|nullguessCA()
Check default locations for the CA bundle
private
guessCA() : string
Tags
Return values
stringsetCA()
private
setCA() : void
Tags
setRequestOptions()
private
setRequestOptions() : void