PHP写的资源下载防盗链类分享(2)

// 输出远程资源
    header("Content-type:text/html;charset=utf-8");
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename='.$FileCon['FileName']);
    header("Accept-Ranges: bytes");
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control:must-revalidate,post-check=0,pre-check=0');
    header('Pragma: public');
    header('Content-Length: '.$FileCon['FileSize']);
    while (!feof($fp)){
     set_time_limit(0);                                                                                 // 设置文件最长执行时间
     echo fread($fp, 1024);                                                                             // 输出文件
     flush();                                                                                           // 输出缓冲
     ob_flush();                                                                                        // 输出缓冲区中的内容
    }
    fclose($fp);
   }else{
    header("HTTP/1.1 404 Not Found");
   }
  }else{
   header("HTTP/1.1 301 Moved Permanently");
   header("Location: ".$this->Location);
  }
 }
}
// 远程资源地址
$dowUrl = 'http://dldir1.qq.com/qqfile/qq/QQ5.1/10055/QQ5.1.exe';
// 转跳地址
$Location = 'http://jb51.net';
// 许可来路域名列表
$allowUrl = array(
 'jb51.net',
);
$BurglarDow = new BurglarDow($dowUrl,$Location,$allowUrl);
$BurglarDow -> dow();

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/20927d1e3fa753ae12b48552dbc6005c.html