This is actually not too hard to do. Except that the tags are stripped out by the browser.
In my file I have this text:
<VirtualHost 127.0.0.1:80>
ServerAdmin email.com
DocumentRoot /path/to/doc
ServerName something.com
ErrorLog logs/here
CustomLog logs/here
</VirtualHost>
$myFile = "file.txt";
$fh = fopen($myFile, 'r'); // open file to read it
$theData = fread($fh, filesize($myFile));
fclose($fh);
echo nl2br($theData);
When I open it in a browser, this is what I see:
ServerAdmin email.com
DocumentRoot /path/to/doc
ServerName something.com
ErrorLog logs/here
CustomLog logs/here
Obviously the browser is taking out the top and bottom, since they are formatted as tags.
How do I read a file that has tags in it, without stripping the tags out, or allowing the browser to translate the tags into some browser view?
thanks!