\GuzzleHttp\HandlerCurlMultiHandler

Returns an asynchronous response using curl_multi_* functions.

When using the CurlMultiHandler, custom curl options can be specified as an associative array of curl option constants mapping to values in the curl key of the provided request options.

Summary

Methods
Properties
Constants
__construct()
__get()
__destruct()
__invoke()
tick()
execute()
$_mh
No constants found
No protected methods found
No protected properties found
N/A
addRequest()
cancel()
processMessages()
timeToNext()
$factory
$selectTimeout
$active
$handles
$delays
$options
N/A

Properties

$_mh

$_mh : resource|\CurlMultiHandle

Internal use only. Lazy loaded multi-handle.

Type

resource|\CurlMultiHandle

$selectTimeout

$selectTimeout : integer

Type

integer

$active

$active : resource|\CurlMultiHandle|null

Type

resource|\CurlMultiHandle|null — the currently executing resource in `curl_multi_exec`.

$handles

$handles : array

Type

array — Request entry handles, indexed by handle id in `addRequest`.

$delays

$delays : \GuzzleHttp\Handler\array<int,

Type

\GuzzleHttp\Handler\array

$options

$options : \GuzzleHttp\Handler\array<mixed>

Type

\GuzzleHttp\Handler\array — An associative array of CURLMOPT_* options and corresponding values for curl_multi_setopt()

Methods

__construct()

__construct(array  $options = array()) 

This handler accepts the following options:

  • handle_factory: An optional factory used to create curl handles
  • select_timeout: Optional timeout (in seconds) to block before timing out while selecting curl handles. Defaults to 1 second.
  • options: An associative array of CURLMOPT_* options and corresponding values for curl_multi_setopt()

Parameters

array $options

__get()

__get(string  $name) : resource|\CurlMultiHandle

Parameters

string $name

Throws

\BadMethodCallException

when another field as _mh will be gotten

\RuntimeException

when curl can not initialize a multi handle

Returns

resource|\CurlMultiHandle

__destruct()

__destruct() 

tick()

tick() 

Ticks the curl event loop.

execute()

execute() 

Runs until all outstanding connections have completed.

addRequest()

addRequest(array  $entry) 

Parameters

array $entry

cancel()

cancel(integer  $id) : boolean

Cancels a handle from sending and removes references to it.

Parameters

integer $id

Handle ID to cancel and remove.

Returns

boolean —

True on success, false on failure.

processMessages()

processMessages() 

timeToNext()

timeToNext()