Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adriengibrat/torrent-rw
php5 class to read and write .torrent files
https://github.com/adriengibrat/torrent-rw
Last synced: 25 days ago
JSON representation
php5 class to read and write .torrent files
- Host: GitHub
- URL: https://github.com/adriengibrat/torrent-rw
- Owner: adriengibrat
- License: gpl-3.0
- Created: 2009-03-11T15:03:43.000Z (almost 16 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T09:47:01.000Z (about 2 years ago)
- Last Synced: 2024-08-04T22:19:14.005Z (4 months ago)
- Language: PHP
- Homepage:
- Size: 93.8 KB
- Stars: 317
- Watchers: 40
- Forks: 104
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- php-awesome - Torrent RW - Torrent 文件读写 (类库 / URL/Domain)
README
Torrent RW
PHP version 5.2+
1) Features:
- Decode torrent file or data
- Build torrent from source folder/file(s)
- Silent Exception error system2) Usage example
```php
require_once 'Torrent.php';// get torrent infos
$torrent = new Torrent( './test.torrent' );
echo '
private: ', $torrent->is_private() ? 'yes' : 'no',
'
annonce: ', $torrent->announce(),
'
name: ', $torrent->name(),
'
comment: ', $torrent->comment(),
'
piece_length: ', $torrent->piece_length(),
'
size: ', $torrent->size( 2 ),
'
hash info: ', $torrent->hash_info(),
'
stats: ';
var_dump( $torrent->scrape() );
echo '
content: ';
var_dump( $torrent->content() );
echo '
source: ',
$torrent;// get magnet link
$torrent->magnet(); // use $torrent->magnet( false ); to get non html encoded ampersand// create torrent
$torrent = new Torrent( array( 'test.mp3', 'test.jpg' ), 'http://torrent.tracker/annonce' );
$torrent->save('test.torrent'); // save to disk// modify torrent
$torrent->announce('http://alternate-torrent.tracker/annonce'); // add a tracker
$torrent->announce(false); // reset announce trackers
$torrent->announce(array('http://torrent.tracker/annonce', 'http://alternate-torrent.tracker/annonce')); // set tracker(s), it also works with a 'one tracker' array...
$torrent->announce(array(array('http://torrent.tracker/annonce', 'http://alternate-torrent.tracker/annonce'), 'http://another-torrent.tracker/annonce')); // set tiered trackers
$torrent->comment('hello world');
$torrent->name('test torrent');
$torrent->is_private(true);
$torrent->httpseeds('http://file-hosting.domain/path/'); // Bittornado implementation
$torrent->url_list(array('http://file-hosting.domain/path/','http://another-file-hosting.domain/path/')); // GetRight implementation// print errors
if ( $errors = $torrent->errors() )
var_dump( $errors );// send to user
$torrent->send();
```