Echoing a text document


#1

Hey,
I need to know how to grab a text document and display the text inisde it.

Thanks


#2

[php]
$file = “./users.txt”;
$fp = fopen("$file", “a+”);
while (!feof($fp)) $content .= fgetc($fp);
$content = $content;
fclose($fp);
[/php]

$contents would be your result variable.


#3

even more basic than that you could do :

[php]
echo “

”;
include (‘path/to/document.txt’);
echo “
”;
[/php]

If there is no need to parse any of the text document then you can just include the entire document. I used the PRE tags which will present the text document as it was originally.

Good luck