 <p>You would use the "Content-Disposition" header to provide a recommended filename and force the web browser to show the save dialog.</p> <p>For example:</p> <pre><code>&lt;?php header('Content-type: text/xml'); header('Content-Disposition: attachment; filename="downloaded.xml"'); // ...your other code ?&gt; </code></pre> <p>This isn't guaranteed to work on all server setups and all browsers so you will find further information on the PHP header function page: <a href="http://php.net/manual/en/function.header.php" rel="nofollow">http://php.net/manual/en/function.header.php</a></p>