File_Bittorrent
[ class tree: File_Bittorrent ] [ index: File_Bittorrent ] [ all elements ]

Source for file example_mktorrent.php

Documentation is available at example_mktorrent.php

  1. <?php
  2.  
  3.  
  4. require_once 'File/Bittorrent/MakeTorrent.php';
  5.  
  6. // Set error handling
  7. PEAR::setErrorHandling(PEAR_ERROR_PRINT);
  8.  
  9. $MakeTorrent = new File_Bittorrent_MakeTorrent('example.php');
  10.  
  11. // Set the announce URL
  12. $MakeTorrent->setAnnounce('http://www.example.org');
  13. // Set the comment
  14. $MakeTorrent->setComment('Hello World!');
  15. // Set the piece length (in KB)
  16. $MakeTorrent->setPieceLength(256);
  17. // Build the torrent
  18. $metainfo $MakeTorrent->buildTorrent();
  19. // Then put this into a file, instead of echoing it normally...
  20. echo $metainfo;
  21.  
  22. ?>

Documentation generated on Mon, 11 Mar 2019 14:57:21 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.