This is what worked for me. In readfile('newfile.xml');make sure the path to the file is correct. This php page is called from an html page with an anchor tag that says - download:
<?php
header('Content-disposition: attachment; filename="newfile.xml"');
header('Content-type: "text/xml"; charset="utf8"');
readfile('newfile.xml');
?>
source: ?