Documentation

AbstractCurl extends AbstractHandler
in package

AbstractYes

HTTP client abstract curl class

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

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

version
6.0.0

Table of Contents

Properties

$httpVersion  : string
HTTP version
$options  : array<string|int, mixed>
Curl options
$request  : Request|null
The request currently being (or last) prepared, carried so a thrown Client\Handler\Exception can implement NetworkExceptionInterface::getRequest()
$resource  : mixed
Client resource object
$response  : mixed
Curl response
$uri  : string|null
URI string

Methods

__construct()  : mixed
Constructor
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
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
removeOption()  : AbstractCurl
Remove Curl option
reset()  : AbstractHandler
Method to reset the handler
resource()  : mixed
Get the resource (alias method)
send()  : mixed
Method to send the request
setOption()  : AbstractCurl
Set Curl option
setOptions()  : AbstractCurl
Set Curl options
setResponse()  : AbstractCurl
Get Curl response
version()  : array<string|int, mixed>
Return the Curl version
collectRequestHeaders()  : array<string|int, mixed>
Collect the flat list of header strings for a request, shared by every handler
resolveRequestBody()  : array<string|int, mixed>
Resolve what a request's outbound body should be, shared by every handler.

Properties

$options

Curl options

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

$request

The request currently being (or last) prepared, carried so a thrown Client\Handler\Exception can implement NetworkExceptionInterface::getRequest()

protected Request|null $request = null

$response

Curl response

protected mixed $response = null

Methods

__construct()

Constructor

public abstract __construct([array<string|int, mixed>|null $options = null ]) : mixed

Instantiate the Curl handler object

Parameters
$options : array<string|int, mixed>|null = null
Tags
throws
Exception

curl()

Return curl resource (alias to $this->getResource())

public curl() : mixed

disconnect()

Close the handler connection

public abstract 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

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

resource()

Get the resource (alias method)

public resource() : mixed

version()

Return the Curl version

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

collectRequestHeaders()

Collect the flat list of header strings for a request, shared by every handler

protected collectRequestHeaders(Request $request) : array<string|int, mixed>
Parameters
$request : Request
Return values
array<string|int, mixed>

resolveRequestBody()

Resolve what a request's outbound body should be, shared by every handler.

protected resolveRequestBody(Request $request) : array<string|int, mixed>

Multipart requests resolve to the curl-native array shape (scalars + CURLFile), which Curl can pass directly to CURLOPT_POSTFIELDS for zero-copy file streaming; handlers without that capability (Stream) fall back to Body\Multipart::build().

Parameters
$request : Request
Return values
array<string|int, mixed>

        
On this page

Search results