Jump to content

Simple PHP question for a beginner


rtumatt1

Recommended Posts

Hi I have tried some html and php file but all i get is the entire information just printed to my browser so for example instead of

 

Piece_length: 5

 

i just get

 

“\nPiece_length: “, $torrent->piece_length()

 

im fairly new to php so probably something im doing wrong. Any help thanks

 

i got the code from: http://w-shadow.com/blog/2008/11/11/parse-edit-and-create-torrent-files-with-php/

Link to comment
Share on other sites

<HTML>

<?PHP

require_once 'Torrent.php';

 

/***********************

    Get torrent info

***********************/

$torrent = new Torrent( './test.torrent' );

echo "<pre>\nPrivate: ", $torrent->is_private() ? 'yes' : 'no',

    "\nAnnounce: ", $torrent->announce(),

    "\nName: ", $torrent->name(),

    "\nComment: ", $torrent->comment(),

    "\nPiece_length: ", $torrent->piece_length(),

    "\nSize: ", $torrent->size( 2 ),

    "\nHash info: ", $torrent->hash_info(),

    "\nStats: ";

    var_dump( $torrent->scrape() );

    echo "\nContents: ";

    var_dump( $torrent->content() );

?>

</HTML>

 

thats my code, in a HTML file and it just prints all the code not actually treating it as variables etc.

Link to comment
Share on other sites

Is it saved with a .php extension? If not, remane it so it is.

 

If that doesn't work, create a new file, paste the below into it, save it as phpinfo.php, then call it into your browser. It should generate a page with your local server information. Let us know what happens.

<?php
phpinfo();
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.