<?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 [PHP] /files/list_folder returns Curl Error 51 in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/PHP-files-list-folder-returns-Curl-Error-51/m-p/254919#M14735</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Related SDK and Issue:&lt;/STRONG&gt;&lt;BR /&gt;&lt;A href="https://github.com/kunalvarma05/dropbox-php-sdk/issues/100" target="_self"&gt;https://github.com/kunalvarma05/dropbox-php-sdk/issues/100&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Warning: cURL error 51: SSL: no alternative certificate subject name matches target host name 'api.dropboxapi.com' (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Test Script&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://api.dropboxapi.com/2/files/list_folder");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CAINFO, "cacert.pem");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"path\":\"\"}");
curl_setopt($ch, CURLOPT_POST, 1);

$headers = array();
$headers[] = "Authorization: Bearer &amp;lt;TOKEN&amp;gt;";
$headers[] = "Content-Type: application/json";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close ($ch);

var_dump($result);&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;When I use api.&lt;STRONG&gt;dropbox.com, &lt;/STRONG&gt;/files/list_folder works, but not /files/download:&lt;/P&gt;&lt;PRE&gt;Incorrect host for API function files/download. You must issue the request to content.dropboxapi.com&lt;/PRE&gt;&lt;P&gt;Needless to say that content.dropbox.com isn't available in v2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 09:16:55 GMT</pubDate>
    <dc:creator>straightvisions</dc:creator>
    <dc:date>2019-05-29T09:16:55Z</dc:date>
    <item>
      <title>[PHP] /files/list_folder returns Curl Error 51</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/PHP-files-list-folder-returns-Curl-Error-51/m-p/254919#M14735</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Related SDK and Issue:&lt;/STRONG&gt;&lt;BR /&gt;&lt;A href="https://github.com/kunalvarma05/dropbox-php-sdk/issues/100" target="_self"&gt;https://github.com/kunalvarma05/dropbox-php-sdk/issues/100&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Warning: cURL error 51: SSL: no alternative certificate subject name matches target host name 'api.dropboxapi.com' (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Test Script&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://api.dropboxapi.com/2/files/list_folder");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CAINFO, "cacert.pem");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"path\":\"\"}");
curl_setopt($ch, CURLOPT_POST, 1);

$headers = array();
$headers[] = "Authorization: Bearer &amp;lt;TOKEN&amp;gt;";
$headers[] = "Content-Type: application/json";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close ($ch);

var_dump($result);&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;When I use api.&lt;STRONG&gt;dropbox.com, &lt;/STRONG&gt;/files/list_folder works, but not /files/download:&lt;/P&gt;&lt;PRE&gt;Incorrect host for API function files/download. You must issue the request to content.dropboxapi.com&lt;/PRE&gt;&lt;P&gt;Needless to say that content.dropbox.com isn't available in v2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:16:55 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/PHP-files-list-folder-returns-Curl-Error-51/m-p/254919#M14735</guid>
      <dc:creator>straightvisions</dc:creator>
      <dc:date>2019-05-29T09:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: [PHP] /files/list_folder returns Curl Error 51</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/PHP-files-list-folder-returns-Curl-Error-51/m-p/254929#M14739</link>
      <description>&lt;P&gt;The&amp;nbsp;api.dropboxapi.com host is &lt;A href="https://www.ssllabs.com/ssltest/analyze.html?d=content.dropboxapi.com&amp;amp;s=162.125.3.8&amp;amp;latest" target="_self"&gt;currently being served with a valid certificate&lt;/A&gt;, so it's not clear why your client isn't trusting it. (Is there any security software, e.g., firewall, or a proxy that may be intefering?)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case, the /2/files/list_folder endpoint does need to be called on the&amp;nbsp;Dropbox API servers, for which either of these host names are valid:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;api.dropbox.com&lt;/LI&gt;
&lt;LI&gt;api.dropboxapi.com&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The&amp;nbsp; /2/files/download endpoint does need to be called on the&amp;nbsp;Dropbox API content servers, for which either of these host names are valid:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;api-content.dropbox.com&lt;/LI&gt;
&lt;LI&gt;content.dropboxapi.com&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(Note that at the end of your post you mentioned "content.dropbox.com isn't available in v2". That is true in that "content.dropbox.com" is not a valid host name, but "content.dropboxapi.com" is valid and does serve API v2.)&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2017 17:04:00 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/PHP-files-list-folder-returns-Curl-Error-51/m-p/254929#M14739</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-12-01T17:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: [PHP] /files/list_folder returns Curl Error 51</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/PHP-files-list-folder-returns-Curl-Error-51/m-p/255185#M14751</link>
      <description>&lt;P&gt;Thank you for your detailed answer. Based on this, I was able to track down the bug, which was indeed a wrong content url.&lt;BR /&gt;&lt;BR /&gt;Thank you, issue solved.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2017 08:17:36 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/PHP-files-list-folder-returns-Curl-Error-51/m-p/255185#M14751</guid>
      <dc:creator>straightvisions</dc:creator>
      <dc:date>2017-12-04T08:17:36Z</dc:date>
    </item>
  </channel>
</rss>

