fuel / core

Fuel PHP Framework - The core of the Fuel v1 framework
http://fuelphp.com
813 stars 345 forks source link

Feature request: Multi-thread cURL #1464

Closed haqqi closed 11 years ago

haqqi commented 11 years ago

Current cURL wrapper only support single request. I think it would be good if FuelPHP has a feature of Multi-thread cURL.

The use case:

$curl = Request::forge('curl');
for($i = 0; $i < 10; $i++) {
  $curl->add_request('http://a-domain.com/', 'callback', array('request-number' => $i));
}

$temp_var = array();
function some_callback($response, $param) {
  $temp_var[$param['request-number']] = $response->response(); //maybe we can use response wrapper
}

Several libraries i have tried, but i was not satisfied:

frankdejonge commented 11 years ago

I suggest using Guzzle for this, it's feature-full and supports this out of the box: http://guzzlephp.org/http-client/client.html#sending-requests-in-parallel