mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-27 18:50:43 +00:00
Merge pull request #399 from kaihempel/multicurl
Add a curl add method for direct handle attach
This commit is contained in:
@@ -285,6 +285,19 @@ class MultiCurl
|
||||
return $curl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a Curl instance to the handle queue
|
||||
*
|
||||
* @access public
|
||||
* @param $curl
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addCurl(Curl $curl)
|
||||
{
|
||||
$this->queueHandle($curl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Before Send
|
||||
*
|
||||
|
||||
@@ -2408,4 +2408,16 @@ class MultiCurlTest extends PHPUnit_Framework_TestCase
|
||||
});
|
||||
$multi_curl->start();
|
||||
}
|
||||
|
||||
public function testAddCurl()
|
||||
{
|
||||
$curl = new Curl\Curl();
|
||||
$curl->setUrl(Test::TEST_URL);
|
||||
$curl->setOpt(CURLOPT_CUSTOMREQUEST, 'GET');
|
||||
$curl->setOpt(CURLOPT_HTTPGET, true);
|
||||
|
||||
$multi_curl = new MultiCurl();
|
||||
$multi_curl->addCurl($curl);
|
||||
$multi_curl->start();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user