root/trunk2/example_mktorrent.php
| Revision 77, 498 bytes (checked in by m, 17 months ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | <?php |
| 2 | |
| 3 | error_reporting(E_ALL); |
| 4 | |
| 5 | require_once 'File/Bittorrent2/MakeTorrent.php'; |
| 6 | |
| 7 | $MakeTorrent = new File_Bittorrent2_MakeTorrent('example.php'); |
| 8 | |
| 9 | // Set the announce URL |
| 10 | $MakeTorrent->setAnnounce('http://www.example.org'); |
| 11 | // Set the comment |
| 12 | $MakeTorrent->setComment('Hello World!'); |
| 13 | // Set the piece length (in KB) |
| 14 | $MakeTorrent->setPieceLength(256); |
| 15 | // Build the torrent |
| 16 | $metainfo = $MakeTorrent->buildTorrent(); |
| 17 | // Then put this into a file, instead of echoing it normally... |
| 18 | echo $metainfo; |
| 19 | |
| 20 | ?> |
Note: See TracBrowser
for help on using the browser.