2015-10-03 34 views
0

我創建一個洪流平臺(沒有跟蹤器),我從服務器下載洪流時遇到一些問題。通過PHP下載一個洪流文件

這是我的腳本的一部分:

$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);

當我通過這個文件下載torrent(在我的例子中是download.php)時,torrent不是有效的bencoding。 什麼問題或我必須做什麼?

回答

0

我想這可能工作......能不能夠測試其洪流鏈接都被禁止在我的國家:-(

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

我認爲這是行不通的。我使用$ _FILES上傳文件 –

+1

無論如何,如果我通過FileZilla從文件服務器下載文件(拖放文件),洪流正在工作,它是兄弟當我用上面的腳本下載它時。 –

0

PHP單獨不能下載種子,你可能需要安裝transmission並使用transmission api來管理和下載種子PHP

+0

TBDev它可以下載bencode和bdecode種子。我試過兩種。我解碼並編碼洪流,但沒有成功 –

+0

誰是** TBDev **!? –

+0

洪流平臺。 FileList.ro正在使用它。 –