require_once 'Torrent.class.php'; // create torrent $torrent = new Torrent('./torrents', 'http://torrent.tracker/annonce'); if (!($error = $torrent->error())) { $torrent->save('test.torrent'); // save to disk } else { echo '<br>DEBUG: ', $error; // error method return the last error message } // print torrent info $torrent = new Torrent('./test.torrent'); echo '<pre>private: ', $torrent->is_private() ? 'yes' : 'no', '<br>annonce: '; var_dump($torrent->announce()); echo '<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; // 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');