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

sql - VB.NET Operand type clash: date is incompatible with int error -

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

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -