-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Jack,
Two things: Twitter requires you to use HTTP-POST instead of GET. see http://dev.twitter.com/doc/post/statuses/update (I don't have much experience with twitter myself, but from what I gathered their error message "incorrect signature" may be misleading and applies to other errors as well.) You also need to sign the URL _with_ the status query parameter alike: char *postargs; char myurl[1024]; sprintf(myurl, "%s?status=%s", update_url, "newstatus"); req_url = oauth_sign_url2(myurl, &postargs, OA_HMAC, NULL, customerKey, customerSecret, access_token, access_token_secret); response = oauth_http_post(req_url,postargs); if (postargs) free(postargs); HTH, robin On 09/19/10 13:28, jack wrote: > I wrote a twitter client use C, I want test make a tweet, but when I > send the strings XML returned "incorrect signature", I hope someone > can tell me how to do. > > Code: > > > #include <stdio.h> > #include <stdlib.h> > #include <oauth.h> > #include <string.h> > #include "urlcode.h" > > int main(void) > { > const char > *customerKey = "ZjDRxcsmKBth8i4oxuNy9g", > *customerSecret= "GDpuZhrMDlVwkWOSpsz2F8tBPOIEYdEXCNI91033D0"; > char *req_url; > const char *access_token="32941837- > J2ldWeUcO2rejBG1CE1kzVoMIBfzzK6j77k9Db2ib", > > *access_token_secret="MgvUTgzSnlKFgLzJXx65TPI4uqi348IabnoqxQtbvI"; > > char *update_url="http://api.twitter.com/1/statuses/update.xml"; > char *sig_url; > char *response; > > req_url = oauth_sign_url2(update_url, NULL, OA_HMAC, NULL, > customerKey, customerSecret, > access_token,access_token_secret); > printf("Post: %s\n", req_url); > > char *newurl = oauth_catenc(2, req_url, "status=test"); > printf("%s\n", newurl); > char *url = oauth_url_unescape(newurl, NULL); > url = oauth_url_escape(url); > printf("%s\n", url); > > > sig_url = malloc(2+strlen(newurl)); > sprintf(sig_url, "%s\n", newurl); > > response = oauth_http_get(req_url,NULL); > > printf("user_timeline xml data:\n%s\n", response); > > if(sig_url) free(sig_url); > if(response) free(response); > return 0; > > } > > Thanks. > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAkyc/J0ACgkQeVUk8U+VK0JOowCgpTuz4c7NHbhzU2nBPws0CFyz DIYAoLAWlfoF6NfCpk1Zi9kfiXGk9OME =6Bz9 -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "OAuth" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/oauth?hl=en.
