1

Is there a way to download file asynchronously with php?

Found this answer but seem like it's not possible to download file using this method

The problem is that I'm need to download file from API but it took a while to download all images and URL isn't available after call.

Thank you

Splinteer
  • 1,126
  • 4
  • 13
  • 28

1 Answers1

1

Thanks to @GuillaumeSTLR I managed to do it with Guzzle Library

To make it work. All you have to do is:

use GuzzleHttp\Client;

$client = new Client();
$client->getAsync($url, [ 'sink' => $file ]);
Splinteer
  • 1,126
  • 4
  • 13
  • 28