I want to download a large file using Guzzle and want to track progress. I don't know if I should stream the stream or use the RequestMediator in some way.
I am testing the following code.
$dl = 'http://archive.ubuntu.com/ubuntu/dists/wily/main/installer-amd64/current/images/netboot/mini.iso'; $client = new Client([]); $request = new GuzzleHttp\Psr7\Request('get', $dl); $promise = $this->client->sendAsync($request, [ 'sink' => '/tmp/test.bin' ]); $promise->then(function (Response $resp) use ( $fs) { echo 'Finished'; }, function (RequestException $e) { }); $promise->wait();
Hint will be appreciated.
source share