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.
--
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.