Documentation

Curl extends AbstractCurl
in package

HTTP client curl handler class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
5.2.0

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

$options

Curl options

protected array<string|int, mixed> $options = []

$response

Curl response

protected mixed $response = 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
throws
Exception

allowSelfSigned()

Set Curl option to set to allow self-signed certs

public allowSelfSigned([bool $allow = true ]) : Curl
Parameters
$allow : bool = true
Return values
Curl

create()

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
throws
Exception
Return values
Curl

curl()

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
string

getErrorNumber()

Get Curl error number

public getErrorNumber() : int
Return values
int

getHttpVersion()

Get the URI string

public getHttpVersion() : string
Return values
string

getInfo()

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>|string

getOption()

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>

getResponse()

Get Curl response

public getResponse() : mixed

getUri()

Get the URI string

public getUri() : string|null
Return values
string|null

hasOption()

Has a Curl option

public hasOption(int $opt) : bool
Parameters
$opt : int
Return values
bool

hasOptions()

Has Curl options

public hasOptions() : bool
Return values
bool

hasResource()

Determine whether or not resource is available

public hasResource() : bool
Return values
bool

hasResponse()

Has a Curl response

public hasResponse() : bool
Return values
bool

hasUri()

Determine whether or not there is a URI string

public hasUri() : bool
Return values
bool

isAllowSelfSigned()

Check if Curl is set to allow self-signed certs

public isAllowSelfSigned() : bool
Return values
bool

isReturnHeader()

Check if Curl is set to return header

public isReturnHeader() : bool
Return values
bool

isReturnTransfer()

Check if Curl is set to return transfer

public isReturnTransfer() : bool
Return values
bool

isVerifyPeer()

Check if Curl is set to verify peer

public isVerifyPeer() : bool
Return values
bool

reset()

Method to reset the handler

public reset([bool $default = true ]) : Curl
Parameters
$default : bool = true
Return values
Curl

resource()

Get the resource (alias method)

public resource() : mixed

setMethod()

Set the method

public setMethod(string $method[, bool $forceCustom = false ]) : Curl
Parameters
$method : string
$forceCustom : bool = false
Return values
Curl

setOption()

Set Curl option

public setOption(int $opt, mixed $val) : AbstractCurl
Parameters
$opt : int
$val : mixed
Return values
AbstractCurl

setReturnHeader()

Set Curl option to return the headers (set to true by default)

public setReturnHeader([bool $header = true ]) : Curl
Parameters
$header : bool = true
Return values
Curl

setReturnTransfer()

Set Curl option to return the transfer (set to true by default)

public setReturnTransfer([bool $transfer = true ]) : Curl
Parameters
$transfer : bool = true
Return values
Curl

setVerifyPeer()

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
Curl

version()

Return the Curl version

public version() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results