Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 2010-05-28 10:59
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>