Skip to content

CurlMultiHandler :: removeHandle(handle)

Brian Boll edited this page Apr 23, 2018 · 2 revisions

CurlMultiHandler :: removeHandle(handle)

$mch = new CurlMultiHandler();
$ch1 = new CurlHandler('http://example.com');
$ch2 = new CurlHandler('http://example.com');
$ch3 = new CurlHandler('http://example.com');

//Add handles
$mch->addHandle($ch1);
$mch->addHandle($ch2);
$mch->addHandle($ch3);

//Removes the handle before the transfer
$mch->removeHandle($ch2);

$mch->execute();

//Removing this handle while it is executing will cause it to halt the transfer
$mch->removeHandle($ch1);

$mch->close();

Note: Removing a handle from the multi handle simply means it will no longer be handled by the multi handler. It will be halted if currently executing. The removed handle can still be used by invoking CurlHandler::execute() on it; be sure to call CurlHandler::close() as well

Parameters [1]:

[1] handle: A CurlHandler object to be removed from the multi handler

Returns:

The numerical constant CURLM_OK (0) will be returned if successful. A number corresponding to an error will be returned otherwise. Those errors are detailed here

Clone this wiki locally