Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>What OAuth signature method are you using? If it's anything but plaintext, then I believe the problem is that you're not passing the body of the HTTP request to <code>getURLQueryString</code>. The body needs to be part of the string that's signed. This explains why you've been able to get a few <code>GET</code> operations to work; those requests don't have a body.</p> <p>Side note: it looks like you're using the POST form of file upload, which, <a href="https://www.dropbox.com/developers/core/docs#files-POST" rel="nofollow">as the docs say</a> is considerably more complex than <a href="https://www.dropbox.com/developers/core/docs#files_put" rel="nofollow">PUT</a>. I think your life will be better if you switch. :-) For example, I think the <code>submit</code> field that you're adding will probably cause the call to not work.</p> <p><strong>EDIT</strong>: Here's a full working example using a manually-constructed plaintext signature. Fill in the app key, app secret, token, and token secret, and be sure to have a file called "hello.txt" for this to work:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;curl/curl.h&gt; #include &lt;iostream&gt; #include &lt;fstream&gt; using namespace std; size_t read_data(void *ptr, size_t size, size_t nmeb, void *stream) { return fread(ptr,size,nmeb,(FILE*)stream); } int main(void) { CURL *curl; CURLcode res; FILE * rfp = fopen("hello.txt", "r"); string appkey = "&lt;APP KEY&gt;"; string appsecret = "&lt;APP SECRET&gt;"; string token = "&lt;ACCESS TOKEN&gt;"; string token_secret = "&lt;ACCESS TOKEN SECRET&gt;"; curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "https://api-content.dropbox.com/1/files_put/sandbox/hello.txt"); struct curl_slist *headers = NULL; string header = "Authorization: OAuth oauth_version=\"1.0\", oauth_signature_method=\"PLAINTEXT\", oauth_consumer_key=\"" + appkey + "\", oauth_token=\"" + token + "\", oauth_signature=\"" + appsecret + "&amp;" + token_secret + "\""; headers = curl_slist_append(headers, header.c_str()); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_PUT, 1L); curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_data); curl_easy_setopt(curl, CURLOPT_READDATA, rfp); res = curl_easy_perform(curl); curl_slist_free_all(headers); if(res != CURLE_OK) fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); curl_easy_cleanup(curl); } fclose(rfp); return 0; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload