Integrations and APIs for Service

Get Involved. Join the Conversation.

Topic

    Bibek Jena
    XML Download
    Topic posted December 19, 2018 by Bibek JenaGreen Ribbon: 100+ Points, last edited December 19, 2018, tagged Connect PHP 
    36 Views, 1 Comment
    Title:
    XML Download
    Summary:
    Download xml file to our local.
    Content:

    Hi All,

    i want to fetch the data from OsvC database and form a xml and download the same xml to my local folder.

    i was able to create a xml file ,but downloading the same file to my local is not working.

    Tried giving below headers for force download:

    header('Content-type: text/xml');
    header('Pragma: public');
    header('Cache-control: private');
    header('Content-Type: application/force-download');
    header('Content-Disposition: attachment; filename=test.xml');

    Not sure why i am not able to download xml file ,but this is what i tried for downloading .xls file which worked fine for me.

    Any help would be Appreciated.

    Thanks and Regards,

    Bibek Kumar Jena 

     

    Version:
    v1.3
    Code Snippet:

    Comment

     

    • Luuk

      You can use application/octet-stream as a MIME type. That should force a download.

      Reference: https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Configuring_server_MIME_types