1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Rep Power

    PHP API file download using Apache

    I have the credentials to access an API, I am able to access and make some calls that returns data with my PHP site. I have the URL and am sending the correct GET request and headers but I need an example of how to create a file download app.

    The way I see it I will create a link that when I click on it in Firefox it will pop-up the box that asks me where I want to save the file. Where can I find an example that shows how to download content (zip archive in this case) from a 3rd party server using their API?

    Thank you
  2. #2
  3. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Washington, USA
    Rep Power
    If you have to send the content yourself (ie, download it to your server and then send it to the user) then read example #1 from the header() manual page to trigger the download prompt. The content you send is what you get from the API.

    Give that a shot and post your code if you have any questions or problems.

IMN logo majestic logo threadwatch logo seochat tools logo