我想从archive.org下载一个文件,目标是正确的,但它使用相同的脚本提供如下0KB的文件,并从我自己的服务器下载相同的文件,它变为TRUE,并且该文件已下载。
这是脚本,链接到提示:
$saveit = '<a href="Files/direct_download.php?path='.$directLink.'/&file='.$fileName.'" id="'.$id.'" style="cursor: pointer;" target="_BLANK">';
$saveit .='<img src="'.$path2icons.'Download32_32.png" class="embedDownload masterTooltip" width="25" height="25" title="حفظ الملف" align="absmiddle" />';
$saveit .='</a>';
echo $saveit;
direct_download.php:
$url = $_GET['path'];
//echo $url.'<br>';
$fileName = $_GET['file'];
//echo $fileName;
set_time_limit(0);
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: application/download");
header("Content-Disposition: filename=$fileName");
$ch = curl_init($url.$fileName);
curl_exec($ch);
curl_close($ch);
exit();
提前致谢
答案 0 :(得分:2)
curl_setopt( $ch, CURLOPT_USERAGENT, "My User Agent" );
system("wget ....")