예제 #1
0
 /**
  * @group decoding
  */
 public function testDecodingFromFile()
 {
     $torrent = B::decodeFromFile(__DIR__ . '/../../examples/xubuntu-10.10-alternate-amd64.iso.torrent');
     $this->assertInternalType('array', $torrent);
     $this->assertInternalType('array', $torrent['info']);
     $this->assertSame('xubuntu-10.10-alternate-amd64.iso', $torrent['info']['name']);
     $this->assertSame(699566080, $torrent['info']['length']);
 }
예제 #2
0
<?php

/*
 * This file is part of the Bencoder package.
 *
 * (c) Daniele Alessandri <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require __DIR__ . '/../autoload.php';
use Bencoder\Bencode;
$torrent = Bencode::decodeFromFile(__DIR__ . '/../examples/xubuntu-10.10-alternate-amd64.iso.torrent');
// Remove info.pieces as it would print too much binary garbage.
unset($torrent['info']['pieces']);
var_dump($torrent);