This way ensure the file is streamed to the disk instead of memory.
- Install guzzle
composer require guzzlehttp/guzzle:~6.0
- Use get.php
<?php | |
require(__DIR__.'/vendor/autoload.php'); | |
use GuzzleHttp\Client; | |
$client = new Client(); | |
$resource = fopen('/tmp/ubuntu.iso', 'w'); | |
$client->request('GET', 'http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso', ['sink' => $resource]); | |
fclose($resource); |