PHP code example of athlon1600 / php-curl-file-downloader

1. Go to this page and download the library: Download athlon1600/php-curl-file-downloader library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

athlon1600 / php-curl-file-downloader example snippets




use Curl\Client;
use CurlDownloader\CurlDownloader;

$browser = new Client();
$downloader = new CurlDownloader($browser);

$response = $downloader->download("https://download.ccleaner.com/cctrialsetup.exe", function ($filename) {
    return './2020-06-07-' . $filename;
});

if ($response->status == 200) {
    // 28,851,928 bytes downloaded in 20.041231 seconds
    echo number_format($response->info->size_download) . ' bytes downloaded in ' . $response->info->total_time . ' seconds';
}
bash
composer