Page 1 of 1

pulling info from a text file

Posted: Sun Aug 01, 2004 7:46 pm
by neobolt
What I am trying to do:
Example:
Page1 http://www.smartmindmedia.com/jokes/index.html
has a link to
http://www.smartmindmedia.com/jokes/ind ... d=test.txt

Click the "test link"
So now your at page
http://www.smartmindmedia.com/jokes/ind ... d=test.txt
In the main section of this page where it says DISPLAY HERE
I want to have the info in the test.txt to display.

would I use
<? echo [http://www.smartmindmedia.com/jokes/"$id"] ?>

This test.txt file is in the directory:
http://www.smartmindmedia.com/jokes/

I really have no idea what I am doing as far as PHP goes, but it seems simple enough so I'm trying to figure it out.

Posted: Sun Aug 01, 2004 7:48 pm
by evilmonkey
Uhh, no. You'd have to open the file using [php_man]fopen[/php_man], and read it using [php_man]fread()[/php_man].
PHP Manual wrote:$filename = "/usr/local/something.txt";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
Then you can echo $contents.

You can alternativly use [php_man]file_get_contents()[/php_man] to read your text file, it apparently works better.

Posted: Sun Aug 01, 2004 8:22 pm
by neobolt
Thank you
I think I can figure it out from that.