View Full Version : PHP downloading from a remote file with resume

07-21-2012, 06:27 PM
1) Project Details: PHP downloading from a remote file with resume

2) Payment method/ details: PayPal

Hello there I'm looking for someone to develop a php code to download a file from a remote server through another server to the user pc, its simple instead of saving the packet on the server you echo it to the browser and of course with proper headers i posted a working code here but i want you to do the following. also look at the picture, it will help u to understand better

- proper headers handling
- support resume
- proper range handling
- emptying the buffers after each packet (this is very important specially when downloading large files)

$start_range = 0;
$url = URL to remote file
$end_range = $filesize;
while($start_range <= $end_range) {
if(($start_range + 9999999) > $end_range) $range = $start_range.'-';
else $range = $start_range.'-'.($start_range + 9999999);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_REFERER, $refurl);
curl_setopt($ch, CURLOPT_RANGE,$range);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20061204 Firefox/');
$start_range +=10000000;


i will provide you with testing links once agreed on price