有谁知道如何使用 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()
}