I know Top-Master answered this question, but this is an alternative method, that still uses include
. I didn't know enough about PHP to know about the fancy methods, that are probably much more secure.
The <pre>
tag doesn't guarantee that the contents will be displayed verbatim. For example <pre><a>Hello</a></pre>
will show up as Hello, not <a>Hello</a>. To solve this you can use < (less than sign) and &rt; (greater than sign). If you need and actual ampersand ("&"), you can use &.
This modified version should escape <, >, and &. Do not rely on this in terms of security.
ob_start();
include ("myFile.html");
$html = ob_get_contents();
$html = str_replace("&", "&". $html);
$html = str_replace("<", "<". $html);
$html = str_replace(">", ">", $html);
$html = str_replace("\n", "<br/>");