<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: download_zip api in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/download-zip-api/m-p/393731#M978</link>
    <description>&lt;P&gt;i have to return zip archive data but it returns&amp;nbsp;&lt;A href="https://monosnap.com/file/0Dxbpzchbiq8ngZRl42SNEHqbCvmi1" target="_blank"&gt;https://monosnap.com/file/0Dxbpzchbiq8ngZRl42SNEHqbCvmi1&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jan 2020 23:42:46 GMT</pubDate>
    <dc:creator>Андрей Г.2</dc:creator>
    <dc:date>2020-01-30T23:42:46Z</dc:date>
    <item>
      <title>download_zip api</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/download-zip-api/m-p/392520#M963</link>
      <description>&lt;P&gt;function dropbox_download_zip($folder_path, $file_name) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, '&lt;A href="https://content.dropboxapi.com/2/files/download_zip" target="_blank" rel="noopener nofollow noopener noreferrer"&gt;https://content.dropboxapi.com/2/files/download_zip&lt;/A&gt;'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); $headers = array(); $headers[] = "Authorization: Bearer " . DROPBOX_TOKEN . ""; $headers[] = "Dropbox-API-Arg: {\"path\": \"$folder_path\"}"; $headers[] = "Content-Type: application/octet-stream; charset=utf-8"; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); curl_close($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } else { $file_name = $file_name . '.zip'; file_put_contents(get_home_path() . '/' . $file_name, $result); $zipFilePath = get_home_path() . $file_name; $zipBaseName = basename($zipFilePath); header("Content-Type: application/zip"); header("Content-Disposition: attachment; filename=$zipBaseName"); header("Content-Length: " . filesize($zipFilePath)); readfile($zipFilePath);&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/575731" target="_blank" rel="noopener"&gt;@unlink&lt;/A&gt;($zipFilePath); die(); } }&lt;/P&gt;
&lt;P&gt;here is my code, but it only works on a local server, on a real site it produces such an error, why?&amp;nbsp;&lt;A href="https://monosnap.com/file/0Dxbpzchbiq8ngZRl42SNEHqbCvmi1" target="_blank" rel="noopener nofollow noopener noreferrer"&gt;https://monosnap.com/file/0Dxbpzchbiq8ngZRl42SNEHqbCvmi1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2020 11:18:59 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/download-zip-api/m-p/392520#M963</guid>
      <dc:creator>Андрей Г.2</dc:creator>
      <dc:date>2020-01-27T11:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: download_zip api</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/download-zip-api/m-p/392670#M965</link>
      <description>&lt;P&gt;To clarify, is the screenshot you shared showing the rendering of some HTML returned by&amp;nbsp;&lt;A href="https://content.dropboxapi.com/2/files/download_zip" target="_blank"&gt;https://content.dropboxapi.com/2/files/download_zip&lt;/A&gt;?&lt;/P&gt;
&lt;P&gt;Can you share what the rest of the response is, that is, the response status and headers?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2020 16:41:17 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/download-zip-api/m-p/392670#M965</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-01-27T16:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: download_zip api</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/download-zip-api/m-p/393727#M977</link>
      <description>&lt;P&gt;&lt;A href="https://monosnap.com/file/bzYDsX610OoxvTUsRVnWdC1LuBVEDZ" target="_blank"&gt;https://monosnap.com/file/bzYDsX610OoxvTUsRVnWdC1LuBVEDZ&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 23:05:28 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/download-zip-api/m-p/393727#M977</guid>
      <dc:creator>Андрей Г.2</dc:creator>
      <dc:date>2020-01-30T23:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: download_zip api</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/download-zip-api/m-p/393731#M978</link>
      <description>&lt;P&gt;i have to return zip archive data but it returns&amp;nbsp;&lt;A href="https://monosnap.com/file/0Dxbpzchbiq8ngZRl42SNEHqbCvmi1" target="_blank"&gt;https://monosnap.com/file/0Dxbpzchbiq8ngZRl42SNEHqbCvmi1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 23:42:46 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/download-zip-api/m-p/393731#M978</guid>
      <dc:creator>Андрей Г.2</dc:creator>
      <dc:date>2020-01-30T23:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: download_zip api</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/download-zip-api/m-p/393963#M981</link>
      <description>&lt;P&gt;Thanks, but still to clarify, what exactly are you doing to get the result in that second screenshot? That appears to be a&amp;nbsp;Dropbox HTML error page, but the response in the first screenshot indicates that the response was just plain text, not HTML.&lt;/P&gt;
&lt;P&gt;That 400 response should indicate that the API request wasn't correctly formatted. The plain text response body should be a more useful error message, so please print that out, e.g., like `echo $result;`.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2020 19:11:51 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/download-zip-api/m-p/393963#M981</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-01-31T19:11:51Z</dc:date>
    </item>
  </channel>
</rss>

