• Stars
    star
    320
  • Rank 130,717 (Top 3 %)
  • Language
    PHP
  • License
    GNU General Publi...
  • Created over 15 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

php5 class to read and write .torrent files

Torrent RW

PHP version 5.2+

  1. Features:
  • Decode torrent file or data
  • Build torrent from source folder/file(s)
  • Silent Exception error system
  1. Usage example
require_once 'Torrent.php';

// get torrent infos
$torrent = new Torrent( './test.torrent' );
echo '<br>private: ', $torrent->is_private() ? 'yes' : 'no', 
	 '<br>annonce: ', $torrent->announce(), 
	 '<br>name: ', $torrent->name(), 
	 '<br>comment: ', $torrent->comment(), 
	 '<br>piece_length: ', $torrent->piece_length(), 
	 '<br>size: ', $torrent->size( 2 ),
	 '<br>hash info: ', $torrent->hash_info(),
	 '<br>stats: ';
var_dump( $torrent->scrape() );
echo '<br>content: ';
var_dump( $torrent->content() );
echo '<br>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();

More Repositories

1

ts-custom-error

Extend native Error to create custom errors
TypeScript
161
star
2

Simple-Database-PHP-Class

Fluent CRUD database utility
PHP
80
star
3

jQuery-SoundManager

Use SoundManager2 with jQuery
JavaScript
67
star
4

Simple-Debug-PHP-Class

Custom error/exception handlers with styled display (trace/scope), logging & chrono tools
PHP
28
star
5

jQuery-gesture

Multistroke gesture recognizer based on $N & Protractor
10
star
6

audio-streamer

Audio Streamer allow to convert virtually any audio file format to a mp3 stream or file
PHP
8
star
7

Simple-Template-PHP-Class

Simple and extensible templating engine with HTML helpers, file caching and data filtering.
PHP
7
star
8

ui-components

Clean & accessible webcomponents
TypeScript
4
star
9

asyncdb

Simple & lightweight IndexedDB wrapper for modern browsers.
TypeScript
3
star
10

svgSprite

Inline SVG sprite FTW
JavaScript
2
star
11

iso-duration

Parse ISO 8601 duration in Typescript
TypeScript
2
star
12

messageformat

i18n message formating, all inclusive
JavaScript
2
star
13

Less-CSS3-utilities

2
star
14

jQuery-spinner

Create spinners using utf8 characters
2
star
15

fp

ES6 Functional Programming
JavaScript
2
star
16

kamaSutra

Apply best position to element inside an overflow bounding container
JavaScript
1
star
17

101

fun programming learning for kids
CSS
1
star
18

jira-web-extension

JavaScript
1
star
19

Transduce-md

Transducers, powerful abstractions
HTML
1
star
20

totp

Time based One Time Password Generation
TypeScript
1
star
21

APItools.md

HTML
1
star
22

jQuery-mousecenter

jQuery event triggered when mouse enter & leave center of an element
JavaScript
1
star