Sep 3, 2010, 6:14 AM
Post #1 of 1
Twitter with Perl
sometime ago I have programmed a small web application with Perl which is using its own Twitter Account to tweet important events and news. Somehow this application and the tweets have become popular in Germany...
Now, Twitter has changed from basic authorization to OAuth (http://dev.twitter.com/pages/auth) and I am trying to implement OAuth with Perl.
I think, I have all what I need. I have the base string and the signature and I have validated it successfully with the OAuth tester (http://quonos.nl/oauthTester/)
But I don't know exactly how to send the HTTP request to Twitter using HTTP::Request (I don't have NET:OAuth and I cannot install it).
In the Twitter docu (http://dev.twitter.com/pages/auth) as well as in the OAuth spec (http://tools.ietf.org/html/rfc5849#section-3.1) it is shown what you need to send.
I tried to do it this way, but it is not working:
my $request = HTTP::Request->new(POST => $api_url);
authorization => 'OAuth realm="https://api.twitter.com/oauth/',
oauth_nonce => $oauth_nonce,
oauth_signature_method => $oauth_signature_method,
oauth_timestamp => $oauth_timestamp,
oauth_consumer_key => $oauth_consumer_key,
oauth_token => $oauth_token,
oauth_signature => $signature,
oauth_version => $oauth_version
status => $status
my $res = $ua->request($request);
But it is not working. Can you help me to create the correct request with HTTP::Request?