使用curl下载简历文件

时间:2012-07-21 21:10:15

标签: php curl

有没有人知道如何使用curl和PHP下载文件并支持简历。并链接到教程或代码演示将是好的。我现在正在使用此代码,但它不支持恢复,我不知道如何处理标头。将不胜感激

$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:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1'); 
    curl_exec($ch); 
    curl_close($ch); 
    $start_range +=10000000; 
    flush(); 
        ob_flush() 
}  

0 个答案:

没有答案