A PHP class for doing parallel cURL requests.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This PHP class lets you perform multiple cURL requests in parallel. Is also provides a max connections per second setting, so you can start multiple parallel requests at different intervals.

For example you want to make 50 requests, which all take 5 seconds, but you only want to start 5 requests per second. The max connections per second setting will start every second 5 new connections, so your total requests take 14 seconds (at t9, the last 5 connections will start).


The class is written in PHP5 and uses the curl_multi_init() function.


A quick example how to use php-mcurl:

$mcurl = Mcurl::factory();
$mcurl->max_per_second = 1;
$responses = $mcurl->get_content();
echo $responses[0]['content']; // Print response from first URL

2 URLs are fetched in this example with the first one starting at t0 and the second at t1 (max connections per second = 1)


The example scripts are currently online at http://experiments.bonnevoy.com/mcurl/example/client.php