-
Currently when I am using Http facade to fetch some API, the requests are synchronous, so if I made few requests I have to wait for the previous request to finish. Symphony HTTP client have cURL support which allows concurrent requests by default and the following code makes 379 requests in less than half a second. $responses = [];
for ($i = 0; $i < 379; ++$i) {
$uri = "https://http2.akamai.com/demo/tile-$i.png";
$responses[] = $client->request('GET', $uri);
}
foreach ($responses as $response) {
$content = $response->getContent();
// ...
} What do you think about adding this functionality to Laravel core? |
Beta Was this translation helpful? Give feedback.
Answered by
crynobone
Sep 15, 2023
Replies: 1 comment
-
Should already be possible: https://laravel.com/docs/10.x/http-client#concurrent-requests |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
crynobone
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should already be possible: https://laravel.com/docs/10.x/http-client#concurrent-requests