我希望附加文件存在于 CURL 下载功能中,而不是覆盖。我使用此代码,但它不起作用。请帮我。
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_HEADER, 0);
if(isset($_GET['resumedownload'])){
if (file_exists($dir.$dirName.'/movie.flv')) {
$targetFile = fopen($dir.$dirName.'/movie.flv', 'r');
curl_setopt($curl, CURLOPT_INFILE, $targetFile);
}
}
curl_setopt($curl, CURLOPT_TIMEOUT, 3600);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:9.0.1) Gecko/20100101 Firefox/9.0.1");
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_REFERER, $file);
curl_setopt($curl, CURLOPT_COOKIEFILE,'cookie.txt');
curl_setopt($curl, CURLOPT_NOPROGRESS, false );
curl_setopt($curl, CURLOPT_PROGRESSFUNCTION, 'progressCallback' );
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FILE, $targetFile );
curl_exec($curl);
fclose($curl);