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
$curl
private
CurlHandle
$curl
$curlOptions
private
array<string|int, mixed>
$curlOptions
= []
$handleID
private
int
$handleID
$initialized
private
bool
$initialized
= false
$options
private
HTTPOptions|SettingsContainerInterface
$options
$request
private
RequestInterface
$request
$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>getCurlResource()
returns the internal cURL resource in its current state
public
getCurlResource() : CurlHandle
Tags
Return values
CurlHandlegetError()
returns a string containing the last error
public
getError() : string
Tags
Return values
stringgetHandleID()
returns the handle ID (cURL resource id)
public
getHandleID() : int
Tags
Return values
intgetInfo()
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>|nullgetRequest()
public
getRequest() : RequestInterface
Tags
Return values
RequestInterfacegetResponse()
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