Skip to content

Instantly share code, notes, and snippets.

@spolu
Created August 14, 2011 17:35
Show Gist options
  • Save spolu/1145102 to your computer and use it in GitHub Desktop.
Save spolu/1145102 to your computer and use it in GitHub Desktop.
Twitter Post
my.consumer_key = '';
my.consumer_secret = '';
my.access_token = '';
my.access_secret = '';
my.oa = new oauth.OAuth("https://api.twitter.com/oauth/request_token",
"https://api.twitter.com/oauth/access_token",
my.consumer_key,
my.consumer_secret,
"1.0",
null,
"HMAC-SHA1");
post = function(status) {
var body = { status: status };
var req = my.oa.post("http://api.twitter.com/1/statuses/update.json",
my.access_token, my.access_secret,
body);
req.on('reponse', function(res) {
console.log('STATUS: ' + res.statusCode);
console.log('HEADERS: ' + JSON.stringify(res.headers));
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log('BODY: ' + chunk);
});
});
req.end();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment