title: How to save an XML file to local file system (client) in PHP?
body: <p>In my site, I have implemented the following functionality: If the user clicks on a button it triggers a PHP function which generates an XML file (that PHP function is called by AJAX). Everything is working well, but here's one thing I want to change: I don't want an .XML file to be created on the server machine; instead, I want the user to be prompted to save the .XML file locally. How do I do that? My PHP script currently looks like this: </p>
  
  <pre><code>$xml = new DOMDocument("1.0", "UTF-8");
  $rootElement = $xml-&gt;appendChild($xml-&gt;createElement("SomeNodeName"));
  ...
  
  // the following doesn't really work - xml doesn't get formatted :)
  $xml-&gt;formatOutput = true; 
  
  // this creates the actual file and places it on server. that's not what i need
  $xml-&gt;save("MyXMLfile.xml"); 
  </code></pre>
  
  <p>Thanks for all the help. </p>