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
https://forums.phpfreaks.com/topic/216470-simple-php-question-for-a-beginner/
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.

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();
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.