<?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: error using PHP file_get_contents to call list_folder api in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/error-using-PHP-file-get-contents-to-call-list-folder-api/m-p/264179#M16864</link>
    <description>&lt;P&gt;I don't believe we have an example for using file_get_contents.&lt;BR /&gt;&lt;BR /&gt;In any case, when you get an error from the API, such as a 400 response, the best first step is to check the response body, which should contain a more useful error.&lt;BR /&gt;&lt;BR /&gt;Anyway, it looks like you have a newer thread, so I'll follow up there:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/PHP-file-download-returns-page-not-found/td-p/264177" target="_blank" rel="noopener"&gt;https://www.dropboxforum.com/t5/API-support/PHP-file-download-returns-page-not-found/m-p/264177#M15462&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 02 Oct 2020 15:54:30 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2020-10-02T15:54:30Z</dc:date>
    <item>
      <title>error using PHP file_get_contents to call list_folder api</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/error-using-PHP-file-get-contents-to-call-list-folder-api/m-p/264162#M16863</link>
      <description>&lt;P&gt;any examples available using the PHP file_get_contents function to call the files/list_folder api?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;( I am able to use curl from PHP to call the dropbox apis. But my code fails on one PHP server but works on another. Would like to see if file_get_contents will work. )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my code.&amp;nbsp; There error I am getting is "f&lt;SPAN&gt;ailed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request&amp;nbsp;"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;function listFolder( $token )
{
  $text = "{\"path\": \"\",\"recursive\": false,\"include_media_info\": false,\"include_deleted\": false,\"include_has_explicit_shared_members\": false,\"include_mounted_folders\": true}" ;
  echo $text . '&amp;lt;br&amp;gt;' ;

  $postdata = http_build_query(
    array(
        'data' =&amp;gt; $text)) ;

  $opts = array(
      'http' =&amp;gt; array(
                'method'  =&amp;gt; 'POST',
                'header'  =&amp;gt; array('Authorization: Bearer ' . $token,
                                   'Content-Type: application/json'),
                'content' =&amp;gt; $postdata),
      'ssl' =&amp;gt; array(
                "verify_peer"=&amp;gt;false,
                "verify_peer_name"=&amp;gt;false)
  );

  $context  = stream_context_create($opts);

  $result = file_get_contents('https://api.dropboxapi.com/2/files/list_folder', false, $context);
}

&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 May 2019 09:15:34 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/error-using-PHP-file-get-contents-to-call-list-folder-api/m-p/264162#M16863</guid>
      <dc:creator>steve_lae0901</dc:creator>
      <dc:date>2019-05-29T09:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: error using PHP file_get_contents to call list_folder api</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/error-using-PHP-file-get-contents-to-call-list-folder-api/m-p/264179#M16864</link>
      <description>&lt;P&gt;I don't believe we have an example for using file_get_contents.&lt;BR /&gt;&lt;BR /&gt;In any case, when you get an error from the API, such as a 400 response, the best first step is to check the response body, which should contain a more useful error.&lt;BR /&gt;&lt;BR /&gt;Anyway, it looks like you have a newer thread, so I'll follow up there:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/PHP-file-download-returns-page-not-found/td-p/264177" target="_blank" rel="noopener"&gt;https://www.dropboxforum.com/t5/API-support/PHP-file-download-returns-page-not-found/m-p/264177#M15462&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2020 15:54:30 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/error-using-PHP-file-get-contents-to-call-list-folder-api/m-p/264179#M16864</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-10-02T15:54:30Z</dc:date>
    </item>
  </channel>
</rss>

