rtumatt1 Posted October 21, 2010 Share Posted October 21, 2010 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/ Quote Link to comment https://forums.phpfreaks.com/topic/216470-simple-php-question-for-a-beginner/ Share on other sites More sharing options...
Pikachu2000 Posted October 21, 2010 Share Posted October 21, 2010 Start by pasting the actual file that's giving you problems here. (not from the tutorial website, the actual one you're working on) Quote Link to comment https://forums.phpfreaks.com/topic/216470-simple-php-question-for-a-beginner/#findComment-1124852 Share on other sites More sharing options...
rtumatt1 Posted October 21, 2010 Author Share Posted October 21, 2010 <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. Quote Link to comment https://forums.phpfreaks.com/topic/216470-simple-php-question-for-a-beginner/#findComment-1124895 Share on other sites More sharing options...
Pikachu2000 Posted October 21, 2010 Share Posted October 21, 2010 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(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/216470-simple-php-question-for-a-beginner/#findComment-1124896 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.