繁体   English   中英

通过PHP下载torrent文件

[英]Download a torrent file through PHP

我正在创建一个torrent平台(没有跟踪器),并且从服务器下载torrent时遇到一些问题。

这是我脚本的一部分:

$fn = dirname(__FILE__) . "/torrents/$id.torrent";
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=$tname.torrent");
header("Content-Length: ".filesize($fn));
header("Content-Type: application/force-download");
header("Content-Transfer-Encoding: binary");
readfile($fn);

当我通过此文件(在我的情况下为download.php)下载torrent时,torrent是无效的bencoding。 有什么问题或我必须做什么?

我认为这可能行得通...无法测试种子链接,因为在我的国家/地区:-(

$file = "abc.torrent" 
$content = file_get_contents('http://www.example.com/sdfsdfs.torrent')
move_uploaded_file($content, '$file');

PHP 不能下载torrent,您可能需要安装Transmission并使用Transmission api来使用PHP管理和下载torrent。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM