www.webdeveloper.com
Results 1 to 3 of 3

Thread: PHP API file download using Apache

  1. #1
    Join Date
    Nov 2012
    Posts
    2

    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
    Jack

  2. #2
    Join Date
    Jan 2009
    Posts
    3,346
    Are you looking for how to force a download dialog?
    http://www.apptools.com/phptools/force-download.php

    Or are you trying to save the contents of a remote file?
    Curl file_get_contents

  3. #3
    Join Date
    Nov 2012
    Posts
    2
    Ok, I have the part below:
    echo "Get:{$item['Uri']}<br>";
    $binaryF = $rsObject->makeCall('get', "/JobData/6530602", "?format=bin");
    echo $binaryF;
    and it produces:
    Get:https://api.xxxxxx.com/JobData/6530602?format=bin
    Making a call to:https://api.xxxxxx.com/JobData/6530602?format=bin
    and below that some junk text - a lot. This I see as the visual representation of the actual zip file that I am supposed to download? How do I get the server to tell the browser what it is sending?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles