PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Ruslan V. Uss   BEncoder   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Simple example, read and decode test.torrent
Class: BEncoder
Encode and decode torrent files in Bencode format
Author: By
Last change:
Date: 13 years ago
Size: 314 bytes
 

Contents

Class file image Download
<pre>
<?php
// Read and dump torrent file
require_once 'BEncoder.inc.php';

$filename = 'test.torrent';
if (!
is_readable ($filename)) die ('Cannot read ' . $filename);

$encoder = new BEncoder ();
$encoder->decode (file_get_contents ($filename));

// Dump out decoded torrent
var_dump ($encoder->source);
?>
</pre>