samedi 9 janvier 2016

Guzzel creating parallel requests based off an array of urls

if I have an array:

[
  'https://some/api/endpoint.com',
  'https://some/api/endpoint.com',
  'https://some/api/endpoint.com',
  'https://some/api/endpoint.com',
  'https://some/api/endpoint.com',
  'https://some/api/endpoint.com',
  'https://some/api/endpoint.com',
];

How would I use:

$responses = $client->send(array(
    $client->get('http://ift.tt/1dyK7FN'),
    $client->get('http://ift.tt/1lxJgvX')
    $client->get('http://ift.tt/J7Vvzj')
));

to set up parallel requests?

When I try to loop over these and store the $client->get($url) in an array to then be sent to $client->send it doesnt work.

Do I want a batch process or .... What? Im not sure.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire