Class Guzzle\Http\Curl\CurlMulti

InheritanceGuzzle\Http\Curl\CurlMulti » Guzzle\Common\AbstractHasDispatcher
ImplementsGuzzle\Common\HasDispatcherInterface, Guzzle\Http\Curl\CurlMultiInterface

Send {@see RequestInterface} objects in parallel using curl_multi

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
beforeSend() Prepare for sending Guzzle\Http\Curl\CurlMulti
createCurlHandle() Create a curl handle for a request Guzzle\Http\Curl\CurlMulti
perform() Get the data from the multi handle Guzzle\Http\Curl\CurlMulti
processResponse() Check for errors and fix headers of a request based on a curl response Guzzle\Http\Curl\CurlMulti
removeErroredRequest() Remove a request that encountered an exception Guzzle\Http\Curl\CurlMulti
removeHandle() Remove a curl handle from the curl multi object Guzzle\Http\Curl\CurlMulti
throwMultiException() Build and throw a MultiTransferException Guzzle\Http\Curl\CurlMulti

Property Details

$exceptions protected property

Queued exceptions

protected array $exceptions = []
$handles protected property

RequestInterface to CurlHandle hash

protected SplObjectStorage $handles null
$multiErrors protected property

CURL multi error values and codes

protected array $multiErrors = [CURLM_BAD_HANDLE => ['CURLM_BAD_HANDLE''The passed-in handle is not a valid CURLM handle.'], CURLM_BAD_EASY_HANDLE => ['CURLM_BAD_EASY_HANDLE'"An easy handle was not good/valid. It could mean that it isn't an easy handle at all, or possibly that the handle already is in used by this or another multi handle."], CURLM_OUT_OF_MEMORY => ['CURLM_OUT_OF_MEMORY''You are doomed.'], CURLM_INTERNAL_ERROR => ['CURLM_INTERNAL_ERROR''This can only be returned if libcurl bugs. Please report it to us!']]
$multiHandle protected property

CURL multi handle.

protected resource $multiHandle null
$requests protected property

Attached {@see RequestInterface} objects.

protected array $requests null
$resourceHash protected property

Hash mapping curl handle resource IDs to request objects

protected array $resourceHash null
$selectTimeout protected property
protected float $selectTimeout null
$successful protected property

Requests that succeeded

protected array $successful = []

Method Details

__construct() public method

public void __construct ( $selectTimeout 1.0 )
$selectTimeout
__destruct() public method

public void __destruct ( )
add() public method

public void add ( Guzzle\Http\Message\RequestInterface $request )
$request
all() public method

public void all ( )
beforeSend() protected method

Prepare for sending

protected void beforeSend ( Guzzle\Http\Message\RequestInterface $request )
$request Guzzle\Http\Message\RequestInterface

Request to prepare

throws Exception

on error preparing the request

count() public method

public void count ( )
createCurlHandle() protected method

Create a curl handle for a request

protected Guzzle\Http\Curl\CurlHandle createCurlHandle ( Guzzle\Http\Message\RequestInterface $request )
$request Guzzle\Http\Message\RequestInterface

Request

perform() protected method

Get the data from the multi handle

protected void perform ( )
processResponse() protected method

Check for errors and fix headers of a request based on a curl response

protected void processResponse ( Guzzle\Http\Message\RequestInterface $request, Guzzle\Http\Curl\CurlHandle $handle, array $curl )
$request Guzzle\Http\Message\RequestInterface

Request to process

$handle Guzzle\Http\Curl\CurlHandle

Curl handle object

$curl array

Array returned from curl_multi_info_read

throws Guzzle\Http\Exception\CurlException

on Curl error

remove() public method

public void remove ( Guzzle\Http\Message\RequestInterface $request )
$request
removeErroredRequest() protected method

Remove a request that encountered an exception

protected void removeErroredRequest ( Guzzle\Http\Message\RequestInterface $request, Exception $e null )
$request Guzzle\Http\Message\RequestInterface

Request to remove

$e Exception

Exception encountered

removeHandle() protected method

Remove a curl handle from the curl multi object

protected void removeHandle ( Guzzle\Http\Message\RequestInterface $request )
$request Guzzle\Http\Message\RequestInterface

Request that owns the handle

reset() public method

public void reset ( $hard false )
$hard
send() public method

public void send ( )
throwMultiException() protected method

Build and throw a MultiTransferException

protected void throwMultiException ( array $exceptions, array $successful )
$exceptions array

Exceptions encountered

$successful array

Successful requests

throws Guzzle\Http\Exception\MultiTransferException