when you say formatting, you mean other than the line breaks? if you want to show all the extra whitespace you could do:
$filename = '/path/to/file.txt';
$handle = fopen($filename, 'r');
$contents = fread($handle, filesize($filename));
fclose($handle);
echo '<pre>' . $contents . '</pre>';