Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <a href="some.xml">Downlad XML</a>
- header('Content-Disposition: attachment; filename="some.xml"');
- <a href="javascript:void(0);" onclick="document.execCommand('SaveAs',true,'some.xml');">Save this page</a>
- private function sendXml($xml, $label) {
- ob_clean();
- header('Content-type: text/plain; charset=UTF-8');
- header('Content-Disposition: attachment; filename="' . $label . '.xml"');
- echo ltrim($xml);
- ob_flush();
- exit;
- }
- <?xml version="1.0" encoding="utf-8"?>
- <feed xmlns="http://www.w3.org/2005/Atom"
- xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
- xmlns:re="http://purl.org/atompub/rank/1.0">
- <title type="text">How to download an XML without the browser
- opening it in another tab - Stack Overflow </title>
- ...
- <a href="http://link/to/file.xml?dummy=dummy" download>Download it!</a>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement