How to get information from. torrent files?

Asked

Viewed 239 times

5

1 answer

5


To display file information torrent with the class Torrent-RW, do the following:

require "Torrent.php";

$torrent = new Torrent('ubuntu-14.10-desktop-i386.iso.torrent');
echo '<pre>Privado? ', $torrent->is_private() ? 'Sim' : 'Não',
     '<br>Anúncio: ';
var_dump($torrent->announce());
echo '<br>Arquivo: ', $torrent->name(),
     '<br>Comentário: ', $torrent->comment(),
     '<br>Tamanho em pedaços: ', $torrent->piece_length(),
     '<br>Tamanho: ', $torrent->size(2),
     '<br>HASH: ', $torrent->hash_info(),
     '<br>Status: ';
var_dump($torrent->scrape());

The result will be something like this:

Privado? Não
Anúncio: array(2) {
  [0]=>
  array(1) {
    [0]=>
    string(39) "http://torrent.ubuntu.com:6969/announce"
  }
  [1]=>
  array(1) {
    [0]=>
    string(44) "http://ipv6.torrent.ubuntu.com:6969/announce"
  }
}

Arquivo: ubuntu-14.10-desktop-i386.iso
Comentário: Ubuntu CD releases.ubuntu.com
Tamanho em pedaços: 524288
Tamanho: 1.11 Go
HASH: 1619ecc9373c3639f4ee3e261638f29b33a6cbd6
Status: array(2) {
  ["http://ipv6.torrent.ubuntu.com:6969/scrape"]=>
  string(29) "Tracker request timeout (30s)"
  ["http://torrent.ubuntu.com:6969/scrape"]=>
  array(4) {
    ["complete"]=>
    int(1609)
    ["downloaded"]=>
    int(29)
    ["incomplete"]=>
    int(72)
    ["name"]=>
    string(29) "ubuntu-14.10-desktop-i386.iso"
  }
}
  • Here it is one print how it should work.

  • Strange, with your file, worked well, everything appears, but with mine do not work.

  • @Lucascarezia Test with other files, it may be that this file .torrent that you use to test is corrupted or something.

  • I tried with some 7/8 files and they all give the same poblema

Browser other questions tagged

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