Created
October 27, 2017 05:02
-
-
Save ndunks/778c7efad0956e0f99deae73c52e718f to your computer and use it in GitHub Desktop.
PHP Curl Downloader with resume support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
set_time_limit(0); | |
ignore_user_abort(true); | |
$url = "http://web.shit/backup.zip"; | |
$ch = curl_init($url); | |
$to_file = 'web.zip'; | |
$opt = array(); | |
if(is_file($to_file)) | |
{ | |
$sz = filesize($to_file); | |
$opt[CURLOPT_RANGE] = $sz . "-"; | |
} | |
$opt[CURLOPT_SSL_VERIFYPEER]= false; | |
$opt[CURLOPT_FILE] = fopen($to_file, 'a'); | |
$opt[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36'; | |
curl_setopt_array($ch, $opt); | |
curl_exec($ch); | |
$grab_info = curl_getinfo($ch); | |
fclose($opt[CURLOPT_FILE]); | |
print_r($grab_info); |
Just change the $url and $to_file, then run it from console or from browser..
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Support me how to use