Skip to content

litek/fetcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cURL wrapper for fetching URLs in parallel

$google = new Fetcher\Client;
$google->queue('http://google.com/', function($response) {
  // handle response
});

$bing = new Fetcher\Client;
$bing->queue('http://bing.com/', function($response, $bing, $master) {
  // you can also queue a new url for fetching when reacting on a response
  $bing->queue('http://url', function($response) {
    // handle response
  });

  // or even attach another client for parallel retrieval
  $yahoo = $master->createClient();
  $yahoo->queue('http://yahoo.com/', function($response) {
    // handle this response
  });
});

// run in parallel
$master = new Fetcher\Parallel;
$master->run([$google, $bing]);

// will be done after the slowest request chain, instead of the sum of requests
echo "Done.";

Multiple requests queued on the same client will be run sequentially.

Can also be used as a cURL wrapper for a single request.

$example = new Fetcher\Client;
$example->queue('http://example.org/', function($response) {
  // handle response
})->run();

About

Parallel cURL wrapper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages