CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Twitter with Perl

 



Lars
New User

Sep 3, 2010, 6:14 AM

Post #1 of 1 (698 views)
Twitter with Perl Can't Post

Hi,

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:


Code
my $request = HTTP::Request->new(POST => $api_url); 
$request->header(
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
);
$request->content_type("text/xml; charset=utf-8");
my $res = $ua->request($request);


But it is not working. Can you help me to create the correct request with HTTP::Request?

Thanks!

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives