If you do save in the same php file, then I do like this
$xmlFileName = 'test2.xml'; $xmlData = $xml->asXML(); $xmlLength = strlen($xmlData); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.$xmlFileName); header('Content-Length: '.$xmlLength); echo $xmlData But in this file I also have the output of the same document, then the save will not work. How can I transfer the $ xmlData variable with the xml document to another file?
The correct option will be to save the file on the server, then send a link with GET with the name of the file, will you upload this file, send it to a computer for saving, and then delete it on the server?