PHP Classes

File: example.php

Recommend this page to a friend!
  Packages of Christoph Kappestein   bencoding   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example script
Class: bencoding
Serialize and unserialize values in bencode format
Author: By
Last change:
Date: 17 years ago
Size: 324 bytes
 

 

Contents

Class file image Download
<?php

header('Content-type: text/plain');

include_once('bencoding.php');

try
{
    $bencode = new bencoding();
    
    $x = $bencode->encode(array('test' => array(1, 'foo', 'bar', 3)));
    
    echo $x . "\n";
    
    $x = $bencode->decode($x);
    
    print_r($x);
}
catch(Exception $e)
{
    echo 'something goes wrong';
}