We Want to Hear From You! What Do You Want to See on the Community? Tell us here!
Forum Discussion
RockwoodON
10 months agoNew member | Level 2
CURL access has recently stopped working
I have been accessing dropbox files using CURL with an access token via the follwing url:
Recently CURL calls are timing out with 0 bytes returned. The formt of my call is as shown below. Has something changed that would cause this to fail? And ideas?
Thanks,
Chris
CODE (PHP):
-----------------------------------------------------------------------------------------
$header_array = array(
'Authorization: Bearer ' . $accessToken,
'Content-Type:',
'Dropbox-API-Arg: {"path":"' . $fileid . '"}'
);
$ch = curl_init();
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_URL, $url);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header_array);
curl_setopt($ch, CURLOPT_FILE, $out_fp);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 20); //timeout in seconds
$output = curl_exec($ch);
4 Replies
- Greg-DB10 months ago
Dropbox Community Moderator
Can you enable verbose mode (that should be "CURLOPT_VERBOSE") and share the full output so we can take a look? Be sure to redact the access token though. Thanks!
- Greg-DB10 months ago
Dropbox Community Moderator
By the way, it appears you are disabling verification, which is a security issue; see https://curl.se/libcurl/c/CURLOPT_SSL_VERIFYHOST.html and https://curl.se/libcurl/c/CURLOPT_SSL_VERIFYPEER.html .
- RockwoodON10 months agoNew member | Level 2
Thanks for your quick reply. I enabled the VERBOSE option, but did not get a response. The CURL error is:
"Operation timed out after 20001 milliseconds with 0 bytes received"
On a more positive note, I can confirm that posting/uploading a file to Dropbox is working, so it is something about the download process. - Greg-DB10 months ago
Dropbox Community Moderator
Is that the entirety of the output you get from curl? There should be more output in verbose mode. For example, when I try this code with verbose mode, I get a bunch of output starting with "* Trying"... which then shows the IP address of the server it connected to, and so on. Can you share the rest of that? It should be useful context for debugging this. Please be sure to redact the access token though. Thanks!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,036 PostsLatest Activity: 9 months ago
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!