php - Guzzle 6 progress of download -


i want download large file guzzle , want track progress. don't know if have pass stream or use requestmediator somehow.

i'm testing 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(); 

an hint appreciated.

though, not mentioned within documentation, can use "progress" request option.

references can found here.

$options = [     'progress' => function ($dl_total_size, $dl_size_so_far, $ul_total_size, $ul_size_so_far) {         // something.     } ]; 

Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -