HumHub Documentation (unofficial)

Curl
in package
implements AdapterInterface, StreamInterface

An adapter class for Laminas\Http\Client based on the curl extension.

Curl requires libcurl. See for full requirements the PHP manual: http://php.net/curl

Table of Contents

Interfaces

AdapterInterface
An interface description for Laminas\Http\Client\Adapter classes.
StreamInterface
An interface description for Laminas\Http\Client\Adapter\Stream classes.

Constants

ERROR_OPERATION_TIMEDOUT  = 28
Operation timeout.

Properties

$config  : array<string|int, mixed>
Parameters array
$connectedTo  : array<string|int, mixed>
What host/port are we connected to?
$curl  : resource|null
The curl session handle
$invalidOverwritableCurlOptions  : array<string|int, mixed>
List of cURL options that should never be overwritten
$outputStream  : resource
Stream for storing output
$response  : string
Response gotten from server

Methods

__construct()  : mixed
Adapter constructor
close()  : mixed
Close the connection to the server
connect()  : void
Initialize curl
getConfig()  : array<string|int, mixed>
Retrieve the array of all configuration options
getHandle()  : resource
Get cUrl Handle
read()  : string
Return read response from server
readHeader()  : int
Header reader function for CURL
setCurlOption()  : $this
Direct setter for cURL adapter related options.
setOptions()  : $this
Set the configuration array for the adapter
setOutputStream()  : $this
Set output stream for the response
write()  : string
Send request to the remote server

Constants

ERROR_OPERATION_TIMEDOUT

Operation timeout.

public int ERROR_OPERATION_TIMEDOUT = 28

Properties

$config

Parameters array

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

$connectedTo

What host/port are we connected to?

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

$curl

The curl session handle

protected resource|null $curl

$invalidOverwritableCurlOptions

List of cURL options that should never be overwritten

protected array<string|int, mixed> $invalidOverwritableCurlOptions

$outputStream

Stream for storing output

protected resource $outputStream

$response

Response gotten from server

protected string $response

Methods

close()

Close the connection to the server

public close() : mixed

connect()

Initialize curl

public connect(string $host[, int $port = 80 ][, bool $secure = false ]) : void
Parameters
$host : string
$port : int = 80
$secure : bool = false
Tags
throws
RuntimeException

If unable to connect.

getConfig()

Retrieve the array of all configuration options

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

getHandle()

Get cUrl Handle

public getHandle() : resource
Return values
resource

read()

Return read response from server

public read() : string
Return values
string

readHeader()

Header reader function for CURL

public readHeader(resource $curl, string $header) : int
Parameters
$curl : resource
$header : string
Return values
int

setCurlOption()

Direct setter for cURL adapter related options.

public setCurlOption(string|int $option, mixed $value) : $this
Parameters
$option : string|int
$value : mixed
Return values
$this

setOptions()

Set the configuration array for the adapter

public setOptions([array<string|int, mixed>|Traversable $options = [] ]) : $this
Parameters
$options : array<string|int, mixed>|Traversable = []
Tags
throws
InvalidArgumentException
Return values
$this

setOutputStream()

Set output stream for the response

public setOutputStream(resource $stream) : $this
Parameters
$stream : resource
Return values
$this

write()

Send request to the remote server

public write(string $method, Uri $uri[, float|string $httpVersion = '1.1' ][, array<string|int, mixed> $headers = [] ][, string $body = '' ]) : string
Parameters
$method : string
$uri : Uri
$httpVersion : float|string = '1.1'
$headers : array<string|int, mixed> = []
$body : string = ''
Tags
throws
RuntimeException

If connection fails, connected to wrong host, no PUT file defined, unsupported method, or unsupported cURL option.

throws
InvalidArgumentException

If $method is currently not supported.

throws
TimeoutException

If connection timed out.

Return values
string

$request


        
On this page

Search results