title: Output Contents of PHP File for a GET/POST request
body: <p>I have a script which generates an XML file when the user accesses the link like so:</p>
  
  <blockquote>
    <p><strong>domain.com/dirList.php</strong></p>
  </blockquote>
  
  <p>I would like to print the contents of the XML to the user at the end of the POST or GET request (have not implemented this yet). At the moment I am just viewing the link through a web browser.</p>
  
  <p>This is the code I am using to print the file contents.</p>
  
  <pre><code># Open XML file and print contents
  $filename = "test.xml";
  $handle = fopen ($filename, "r"); 
  $contents = fread ($handle, filesize ($filename)); 
  fclose ($handle); 
  print $contents;
  </code></pre>
  
  <p>The problem is that it doesn't seem to be working. I think I might be either missing a header like this: <code>("Content-Type: text/xml");</code> or maybe my code is wrong.</p>
  
  <p>What do I need to do to get the XML file to print to the browser?</p>