<?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: Dropbox API for search in PHP in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/227533#M12369</link>
    <description>Apologies, my reply was a little misleading. It seems CURLOPT_WRITEFUNCTION doesn't return a stream object exactly, but it's a way for you to supply a function that will be called multiple times to read data off the reply a piece at a time. &lt;BR /&gt;&lt;BR /&gt;In any case, this is more about using curl in PHP now, which is outside my area of expertise, so you may want to refer to the documentation or support community for PHP/curl for more information on using that.</description>
    <pubDate>Tue, 20 Jun 2017 18:17:39 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2017-06-20T18:17:39Z</dc:date>
    <item>
      <title>Dropbox API for search in PHP</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/225915#M12300</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to search for a file uploaded in my&amp;nbsp;Dropbox APP using the following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;$data = json_encode(array("path" =&amp;gt; "/", "query" =&amp;gt; $this-&amp;gt;filename, "mode" =&amp;gt; "filename"));
$url = 'https://api.dropboxapi.com/2/files/search';
$headers = array('Authorization: Bearer '.$GLOBALS['access_token'],
'data: '.$data,
'Content-Type: application/json');

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_PUT, true);
// Turn off the server and peer verification (TrustManager Concept).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Get response from the server.
$resp = curl_exec($ch); 

echo '&amp;lt;br /&amp;gt;Curl Response: ';
print_r($resp);

curl_close($ch);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm getting the curl response as:&lt;/P&gt;
&lt;PRE&gt;Error in call to API function "files/search": request body: could not decode input as JSON&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Please tell me what correction needs to be done.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:21:33 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/225915#M12300</guid>
      <dc:creator>Priya M.</dc:creator>
      <dc:date>2019-05-29T09:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API for search in PHP</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/225953#M12307</link>
      <description>&lt;P&gt;Looking over your code, there are a few things that should be fixed:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- When specifying the root folder, you need to&amp;nbsp;use the empty string "", not "/".&lt;/P&gt;
&lt;P&gt;- You'll need to POST (CURLOPT_POST) not PUT (CURLOPT_PUT).&lt;/P&gt;
&lt;P&gt;- You should not turn off SSL verification if possible.&lt;/P&gt;
&lt;P&gt;- The parameters must&amp;nbsp;be passed as JSON in the HTTP request body, not in a header.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can find more information on using this endpoint here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-search" target="_blank"&gt;https://www.dropbox.com/developers/documentation/http/documentation#files-search&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's an example of calling an "RPC" endpoint like this in PHP here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/documentation/dropbox-api/412/listing-a-folder/1370/listing-the-root-folder-via-curl-in-php-and-the-curl-extension#t=20170615183729440977" target="_blank"&gt;https://stackoverflow.com/documentation/dropbox-api/412/listing-a-folder/1370/listing-the-root-folder-via-curl-in-php-and-the-curl-extension#t=20170615183729440977&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 18:41:29 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/225953#M12307</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-06-15T18:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API for search in PHP</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/226063#M12324</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your reply. I was able to do that. Removing&amp;nbsp;&lt;SPAN&gt;CURLOPT_PUT resolved &amp;nbsp;the issue.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have now issues with reading the files uploaded on dropbox. I can see that the endpoint for this purpose is :&amp;nbsp;&lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-download" rel="noreferrer noopener noreferrer" target="_blank"&gt;https://www.dropbox.com/developers/documentation/http/documentation#files-download&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I'm not able to understand how to use the output of the above API to read instead of saving the file locally?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 11:37:42 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/226063#M12324</guid>
      <dc:creator>Priya M.</dc:creator>
      <dc:date>2017-06-16T11:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API for search in PHP</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/226165#M12332</link>
      <description>That endpoint returns the file context in the response body. What your app does with that response is up to you. I.e., you can have it read it into memory and do something with it there, or you can save it to a local file.&lt;BR /&gt;&lt;BR /&gt;Here's an example that tells curl to save it to a local file:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://stackoverflow.com/documentation/dropbox-api/408/downloading-a-file/20965/downloading-a-file-with-metadata-via-curl-in-php#t=201706161828140145756" target="_blank"&gt;https://stackoverflow.com/documentation/dropbox-api/408/downloading-a-file/20965/downloading-a-file-with-metadata-via-curl-in-php#t=201706161828140145756&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Alternatively, instead of saving it to a local file using curl's CURLOPT_FILE option, you can read the file data from the curl_exec output, e.g., in that example saved as $output.</description>
      <pubDate>Fri, 16 Jun 2017 18:34:47 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/226165#M12332</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-06-16T18:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API for search in PHP</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/227085#M12355</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We do not want to save in local file. Also, reading in memory may cause memory exhausted issue with large files. Same is the issue with saving the read data in a variable when the file is large enough.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead, we want to read the file in parts instead of reading the entire file at once. Is there any option to the same?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 10:02:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/227085#M12355</guid>
      <dc:creator>Priya M.</dc:creator>
      <dc:date>2017-06-19T10:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API for search in PHP</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/227207#M12361</link>
      <description>The file data is returned in the HTTP response, so you could read from it as a stream if your HTTP client supports it. &lt;BR /&gt;&lt;BR /&gt;It looks like PHP curl's may effectively support this via CURLOPT_WRITEFUNCTION:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://docs.php.net/function.curl-setopt" target="_blank"&gt;http://docs.php.net/function.curl-setopt&lt;/A&gt;</description>
      <pubDate>Mon, 19 Jun 2017 20:51:58 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/227207#M12361</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-06-19T20:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API for search in PHP</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/227232#M12364</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I didn't understand how the file data is returned as a stream. As far as I can see, it returns a normal read data. Can you please elaborate on this with an example?</description>
      <pubDate>Tue, 20 Jun 2017 01:30:28 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/227232#M12364</guid>
      <dc:creator>Priya M.</dc:creator>
      <dc:date>2017-06-20T01:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API for search in PHP</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/227533#M12369</link>
      <description>Apologies, my reply was a little misleading. It seems CURLOPT_WRITEFUNCTION doesn't return a stream object exactly, but it's a way for you to supply a function that will be called multiple times to read data off the reply a piece at a time. &lt;BR /&gt;&lt;BR /&gt;In any case, this is more about using curl in PHP now, which is outside my area of expertise, so you may want to refer to the documentation or support community for PHP/curl for more information on using that.</description>
      <pubDate>Tue, 20 Jun 2017 18:17:39 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/227533#M12369</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-06-20T18:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API for search in PHP</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/228265#M12378</link>
      <description>&lt;P&gt;Thanks for your response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will do the PHP part myself. I got confused by your incorrect reply previously and started searching more in that direction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again for your help.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 12:16:11 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-for-search-in-PHP/m-p/228265#M12378</guid>
      <dc:creator>Priya M.</dc:creator>
      <dc:date>2017-06-21T12:16:11Z</dc:date>
    </item>
  </channel>
</rss>

