I have an XML file on my server which is residing at a private location, so the file cannot be accessed via URL. I am trying to read the contents of the XML file using PHP and want to display it in an HTML page. I have tried several methods such as setting the header('Content-type: text/xml')
but nothing seems to be working. The page is displayed as an empty text. I want to display the XML file similar to way it is displayed in the browser.
The XML that I have to display is something like this.
<simplexmlresult version="1.3" xmlns="http://sdk.prometric.com/schemas/SimpleXMLResults1_3">
<demographics>
<demographic name="Activity" value="5"></demographic>
<demographic name="AddUser" value="20130000"></demographic>
</demographics>
<exam resourcefilename="73392.cer" resourceversion="1.0" name="temp"></exam>
</simplexmlresult>
PHP code for reading file:-
<?php
header("Content-type: text/xml; charset=utf-8");
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
$elig_id = $_GET['eid'];
if($elig_id) {
$filename = get_file_name_from_eligibility($elig_id);
$file = file_get_contents('./folder/temp/done/'.$filename);
print $file;
}
?>