Advertisement
Guest User

Untitled

a guest
Sep 16th, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <a href="some.xml">Downlad XML</a>
  2.  
  3. header('Content-Disposition: attachment; filename="some.xml"');
  4.  
  5. <a href="javascript:void(0);" onclick="document.execCommand('SaveAs',true,'some.xml');">Save this page</a>
  6.  
  7. private function sendXml($xml, $label) {
  8. ob_clean();
  9. header('Content-type: text/plain; charset=UTF-8');
  10. header('Content-Disposition: attachment; filename="' . $label . '.xml"');
  11. echo ltrim($xml);
  12. ob_flush();
  13. exit;
  14. }
  15.  
  16. <?xml version="1.0" encoding="utf-8"?>
  17. <feed xmlns="http://www.w3.org/2005/Atom"
  18. xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
  19. xmlns:re="http://purl.org/atompub/rank/1.0">
  20. <title type="text">How to download an XML without the browser
  21. opening it in another tab - Stack Overflow </title>
  22. ...
  23.  
  24. <a href="http://link/to/file.xml?dummy=dummy" download>Download it!</a>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement