Nimmi
Nimmi

Reputation: 143

php fetch file content and print it out formatted

How can i print out an formatted HTML file ? This is my current code:

echo htmlspecialchars(file_get_contents($url)); 

But the result looks so ugly, all sticks together, no space no tabs. Is there any way to print the file exactly like the original file ?

Upvotes: 0

Views: 537

Answers (1)

Karl
Karl

Reputation: 833

The pre-tag would work.

<pre>
<?php echo htmlspecialchars(file_get_contents($url)); ?>
</pre>

Upvotes: 1

Related Questions