How to get the Magnet link from a . torrent file?

Asked

Viewed 7,188 times

-2

I can get file information .torrent using the class Torrent RW or Torrent-parse, as the file name, size, HASH, etc..

I would also like to get the Magnet link, however I am having difficulties to proceed with this, how can I extract this information using either of these two classes?

  • I didn’t understand your doubt, it’s programming?

  • Yes, those two classes I passed present the problems I mentioned above.

  • Lucas, I edited the question to make it more objective, the way it was was vague, so the rain negative, if my editing is wrong, you can reverse it.

  • Thanks for the help.

1 answer

3


The Torrent RW does not have a function that returns the Magnet Link. Only the Torrent-parse, through function magnet(). Take an example:

error_reporting(E_STRICT);
include 'Torrent.php';

$torrent = new Torrent('tails-i386-1.2.3.torrent');

echo "<pre>";
echo "Nome do arquivo: ". $torrent->name()                . "<br>";
echo "Tamanho: ". $torrent->size(2)                       . "<br>";
echo "Piece length: ". $torrent->piece_length()           . "<br>";
echo "HASH: ". $torrent->hash_info()                      . "<br>";
echo 'Privado: '. ($torrent->is_private() ? 'Sim' : 'Não'). "<br>";
echo 'Comentário: '. $torrent->comment()                  . "<br>";
echo 'Anúncio: '. $torrent->announce()                    . "<br>";
echo 'Status: ', var_dump($torrent->scrape())             . "<br>";
echo "Magnet link: ". $torrent->magnet()                  . "<br>";

The way out will be something like this:

Nome do arquivo: tails-i386-1.2.3
Tamanho: 907.67 Mo
Piece length: 262144
HASH: 957a82ee0d2fb0938952167d6c34dbf7e37a8946
Privado: Não
Comentário: 
Anúncio: http://torrent.gresille.org/announce
Status: array(1) {
  ["http://torrent.gresille.org/scrape"]=>
  array(3) {
    ["complete"]=>
    int(239)
    ["downloaded"]=>
    int(8)
    ["incomplete"]=>
    int(0)
  }
}

Magnet link: magnet:?xt=urn:btih:957a82ee0d2fb0938952167d6c34dbf7e37a8946&dn=tails-i386-1.2.3&xl=951765793&tr=http://torrent.gresille.org/announce
  • Left like this for me File name: Idman.exe Size: 3.71 MB Piece length: 16384 HASH: 1c59a7e81c0321e6bd5646187fe58354baf91f3c Private: No Comment: Announcement: Array Status: array (size=3) 'http://tracker.ccc.de/scrape' => string 'Tracker request failed (404 code)' (length=33) 'http://tracker.openbittorrent.com/scrape' => string 'Tracker request failed (302 code)' (length=33) 'http://tracker.publicbt.com/scrape' => string 'Tracker request timeout (30s)' (length=29)

  • @Lucascarezia I think you are using Torrent RW, use the Botlife.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.