Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/242.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从archive.org下载文件_Php_Download_Archive - Fatal编程技术网

Php 从archive.org下载文件

Php 从archive.org下载文件,php,download,archive,Php,Download,Archive,我想从archive.org下载一个文件,目标是正确的,但它给出了一个0 KB的文件,如下所示,使用相同的脚本,从我自己的服务器下载相同的文件,结果是,文件被下载 以下是脚本,链接到提示: $saveit = '<a href="Files/direct_download.php?path='.$directLink.'/&file='.$fileName.'" id="'.$id.'" style="cursor: pointer;" target="_BLANK">';

我想从archive.org下载一个文件,目标是正确的,但它给出了一个0 KB的文件,如下所示,使用相同的脚本,从我自己的服务器下载相同的文件,结果是,文件被下载

以下是脚本,链接到提示:

$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;
$saveit='';
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();
$url=$\u GET['path'];
//回显$url。“
”; $fileName=$\u获取['file']; //echo$fileName; 设置时间限制(0); 标题(“Pragma:public”); 标题(“到期日:0”); 标头(“缓存控制:必须重新验证,后检查=0,前检查=0”); 标头(“缓存控制:专用”,false); 标题(“内容类型:应用程序/下载”); 标题(“内容配置:filename=$filename”); $ch=curl\u init($url.$fileName); curl_exec($ch); 卷曲关闭($ch); 退出();
提前谢谢

  • 尝试添加用户代理:
  • curl_setopt($ch,CURLOPT_USERAGENT,“我的用户代理”)

  • 请尝试通过wget下载文件

  • system(“wget…”)

    我如何知道用户代理,并且功能系统已从服务器禁用。例如,您可以从$\u服务器使用用户代理['HTTP\u user\u agent']