Skip to content

Commit e087f51

Browse files
committed
Add a curl add method for direct handle attach
1 parent d17da3e commit e087f51

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/Curl/MultiCurl.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,19 @@ public function addSearch($url, $data = array())
285285
return $curl;
286286
}
287287

288+
/**
289+
* Adds a Curl instance to the handle queue
290+
*
291+
* @access public
292+
* @param $curl
293+
*
294+
* @return void
295+
*/
296+
public function addCurl(Curl $curl)
297+
{
298+
$this->queueHandle($curl);
299+
}
300+
288301
/**
289302
* Before Send
290303
*

tests/PHPCurlClass/PHPMultiCurlClassTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2408,4 +2408,16 @@ public function testUnsetHeader()
24082408
});
24092409
$multi_curl->start();
24102410
}
2411+
2412+
public function testAddCurl()
2413+
{
2414+
$curl = new Curl\Curl();
2415+
$curl->setUrl(Test::TEST_URL);
2416+
$curl->setOpt(CURLOPT_CUSTOMREQUEST, 'GET');
2417+
$curl->setOpt(CURLOPT_HTTPGET, true);
2418+
2419+
$multi_curl = new MultiCurl();
2420+
$multi_curl->addCurl($curl);
2421+
$multi_curl->start();
2422+
}
24112423
}

0 commit comments

Comments
 (0)