冷风/glutorrent

由 GluTorrent 开发的 BEncoded BitTorrent 类。

v1.0.2 2014-12-27 11:26 UTC

This package is not auto-updated.

Last update: 2024-09-10 07:24:36 UTC


README

由 GluTorrent 开发的 BEncoded BitTorrent 类。

非官方镜像:https://code.google.com/p/glutorrent/

来源: http://web.archive.org/web/20080127172806/http://www.glutorrent.com/developer/

这是一个由一家名为 GluTorrent 的公司最初开发的 BEncoded BitTorrent 类,曾托管在 http://glutorrent.com/developer

似乎 http://glutorrent.com 域名已经不再活跃,但由于这个类似乎很有用,我想确保后人也能访问到它。

我不是这个代码的所有者或开发者,我也不知道如何联系相关人士,所以如果你知道如何联系这方面的相关人员,请告诉我。我不会继续开发这个类。如果你想要贡献,请告诉我,我将在项目中添加你作为贡献者。

示例

<?php
// http://www.glutorrent.com/developer/
// http://web.archive.org/web/20080127172806/http://www.glutorrent.com/developer/

require 'IBEncodedValue.php';
require 'BEncodingException.class.php';
require 'BEncodingParserException.class.php';
require 'BEncodingInvalidIndexException.class.php';
require 'BEncodingInvalidValueException.class.php';
require 'BEncodingOutOfRangeException.class.php';
require 'BEncodedDictionaryCollection.class.php';
require 'BEncodedDictionary.class.php';
require 'BEncodedDictionaryCollectionIterator.class.php';
require 'BEncodedListCollection.class.php';
require 'BEncodedList.class.php';
require 'BEncodedString.class.php';
require 'BEncodedInteger.class.php';


$MyNewTracker = 'http://tracker.example.com:6969/announce';

// Example of modifying the announce and announce list fields of a torrent

foreach(glob('C:\\torrents\\*.torrent') as $TorrentFile){
    $Torrent = new BEncodedDictionary();
    $Torrent->FromString(file_get_contents($TorrentFile));
    $Torrent['announce-list'] = new BEncodedList();
    $Torrent['announce'] = $MyNewTracker;
    $Torrent['announce-list'][] = new BEncodedList(array($MyNewTracker));
    // Let's see the torrent
    print_r($Torrent->ToArray());
    echo "\n";
    file_put_contents($TorrentFile, $Torrent->Encode());
}
?>