Curl
extends AbstractCurl
in package
HTTP client curl handler class
Tags
Table of Contents
Properties
- $httpVersion : string
- HTTP version
- $options : array<string|int, mixed>
- Curl options
- $resource : mixed
- Client resource object
- $response : mixed
- Curl response
- $uri : string|null
- URI string
Methods
- __construct() : mixed
- Constructor
- allowSelfSigned() : Curl
- Set Curl option to set to allow self-signed certs
- create() : Curl
- Factory method to create a Curl handler
- curl() : mixed
- Return curl resource (alias to $this->getResource())
- disconnect() : void
- Close the handler connection
- getErrorMessage() : string
- Get Curl error number
- getErrorNumber() : int
- Get Curl error number
- getHttpVersion() : string
- Get the URI string
- getInfo() : array<string|int, mixed>|string
- Return the Curl last info
- getOption() : mixed
- Get a Curl option
- getOptions() : array<string|int, mixed>
- Get Curl options
- getResource() : mixed
- Get the resource
- getResponse() : mixed
- Get Curl response
- getUri() : string|null
- Get the URI string
- getUriObject() : Uri
- Get the URI as an object
- hasOption() : bool
- Has a Curl option
- hasOptions() : bool
- Has Curl options
- hasResource() : bool
- Determine whether or not resource is available
- hasResponse() : bool
- Has a Curl response
- hasUri() : bool
- Determine whether or not there is a URI string
- isAllowSelfSigned() : bool
- Check if Curl is set to allow self-signed certs
- isReturnHeader() : bool
- Check if Curl is set to return header
- isReturnTransfer() : bool
- Check if Curl is set to return transfer
- isVerifyPeer() : bool
- Check if Curl is set to verify peer
- parseResponse() : Response
- Parse the response
- prepare() : Curl
- Method to prepare the handler
- removeOption() : AbstractCurl
- Remove Curl option
- reset() : Curl
- Method to reset the handler
- resource() : mixed
- Get the resource (alias method)
- send() : Response
- Method to send the request
- setMethod() : Curl
- Set the method
- setOption() : AbstractCurl
- Set Curl option
- setOptions() : AbstractCurl
- Set Curl options
- setResponse() : AbstractCurl
- Get Curl response
- setReturnHeader() : Curl
- Set Curl option to return the headers (set to true by default)
- setReturnTransfer() : Curl
- Set Curl option to return the transfer (set to true by default)
- setVerifyPeer() : Curl
- Set Curl option to set verify peer (verifies the domain's SSL cert)
- version() : array<string|int, mixed>
- Return the Curl version
Properties
$httpVersion
HTTP version
protected
string
$httpVersion
= '1.1'
$options
Curl options
protected
array<string|int, mixed>
$options
= []
$resource
Client resource object
protected
mixed
$resource
= null
$response
Curl response
protected
mixed
$response
= null
$uri
URI string
protected
string|null
$uri
= null
Methods
__construct()
Constructor
public
__construct([array<string|int, mixed>|null $options = null ][, bool $default = true ]) : mixed
Instantiate the Curl handler object
Parameters
- $options : array<string|int, mixed>|null = null
- $default : bool = true
Tags
allowSelfSigned()
Set Curl option to set to allow self-signed certs
public
allowSelfSigned([bool $allow = true ]) : Curl
Parameters
- $allow : bool = true
Return values
Curlcreate()
Factory method to create a Curl handler
public
static create([string $method = 'GET' ][, array<string|int, mixed>|null $options = null ][, bool $default = true ]) : Curl
Parameters
- $method : string = 'GET'
- $options : array<string|int, mixed>|null = null
- $default : bool = true
Tags
Return values
Curlcurl()
Return curl resource (alias to $this->getResource())
public
curl() : mixed
disconnect()
Close the handler connection
public
disconnect() : void
getErrorMessage()
Get Curl error number
public
getErrorMessage() : string
Return values
stringgetErrorNumber()
Get Curl error number
public
getErrorNumber() : int
Return values
intgetHttpVersion()
Get the URI string
public
getHttpVersion() : string
Return values
stringgetInfo()
Return the Curl last info
public
getInfo([int|null $opt = null ]) : array<string|int, mixed>|string
Parameters
- $opt : int|null = null
Return values
array<string|int, mixed>|stringgetOption()
Get a Curl option
public
getOption(int $opt) : mixed
Parameters
- $opt : int
getOptions()
Get Curl options
public
getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>getResource()
Get the resource
public
getResource() : mixed
getResponse()
Get Curl response
public
getResponse() : mixed
getUri()
Get the URI string
public
getUri() : string|null
Return values
string|nullgetUriObject()
Get the URI as an object
public
getUriObject() : Uri
Return values
UrihasOption()
Has a Curl option
public
hasOption(int $opt) : bool
Parameters
- $opt : int
Return values
boolhasOptions()
Has Curl options
public
hasOptions() : bool
Return values
boolhasResource()
Determine whether or not resource is available
public
hasResource() : bool
Return values
boolhasResponse()
Has a Curl response
public
hasResponse() : bool
Return values
boolhasUri()
Determine whether or not there is a URI string
public
hasUri() : bool
Return values
boolisAllowSelfSigned()
Check if Curl is set to allow self-signed certs
public
isAllowSelfSigned() : bool
Return values
boolisReturnHeader()
Check if Curl is set to return header
public
isReturnHeader() : bool
Return values
boolisReturnTransfer()
Check if Curl is set to return transfer
public
isReturnTransfer() : bool
Return values
boolisVerifyPeer()
Check if Curl is set to verify peer
public
isVerifyPeer() : bool
Return values
boolparseResponse()
Parse the response
public
parseResponse() : Response
Return values
Responseprepare()
Method to prepare the handler
public
prepare(Request|AbstractRequest $request[, Auth|null $auth = null ][, bool $forceCustom = false ][, bool $clear = true ]) : Curl
Parameters
- $request : Request|AbstractRequest
- $auth : Auth|null = null
- $forceCustom : bool = false
- $clear : bool = true
Tags
Return values
CurlremoveOption()
Remove Curl option
public
removeOption(int $opt) : AbstractCurl
Parameters
- $opt : int
Return values
AbstractCurlreset()
Method to reset the handler
public
reset([bool $default = true ]) : Curl
Parameters
- $default : bool = true
Return values
Curlresource()
Get the resource (alias method)
public
resource() : mixed
send()
Method to send the request
public
send() : Response
Tags
Return values
ResponsesetMethod()
Set the method
public
setMethod(string $method[, bool $forceCustom = false ]) : Curl
Parameters
- $method : string
- $forceCustom : bool = false
Return values
CurlsetOption()
Set Curl option
public
setOption(int $opt, mixed $val) : AbstractCurl
Parameters
- $opt : int
- $val : mixed
Return values
AbstractCurlsetOptions()
Set Curl options
public
setOptions(array<string|int, mixed> $options) : AbstractCurl
Parameters
- $options : array<string|int, mixed>
Return values
AbstractCurlsetResponse()
Get Curl response
public
setResponse(mixed $response) : AbstractCurl
Parameters
- $response : mixed
Return values
AbstractCurlsetReturnHeader()
Set Curl option to return the headers (set to true by default)
public
setReturnHeader([bool $header = true ]) : Curl
Parameters
- $header : bool = true
Return values
CurlsetReturnTransfer()
Set Curl option to return the transfer (set to true by default)
public
setReturnTransfer([bool $transfer = true ]) : Curl
Parameters
- $transfer : bool = true
Return values
CurlsetVerifyPeer()
Set Curl option to set verify peer (verifies the domain's SSL cert)
public
setVerifyPeer([bool $verify = true ]) : Curl
Parameters
- $verify : bool = true
Return values
Curlversion()
Return the Curl version
public
version() : array<string|int, mixed>