Hi All I'm trying to update my status through the api and oauth on twitter. I get stuck on the last step, the status update... here's my code: The header:
$ua->default_header('Content-Type' => "application/x-www-form-urle +ncoded"); $ua->default_header('oauth_signature' => "$signature"); $ua->default_header('Authorization' => '"OAuth realm="Twitter API" +'); $ua->default_header('oauth_consumer_key' => "blablabla"); $ua->default_header('oauth_nonce' => "$nonce"); $ua->default_header('oauth_signature_method' => "HMAC-SHA1"); $ua->default_header('oauth_timestamp' => "$epoch"); $ua->default_header('oauth_token' => "$token_final"); $ua->default_header('oauth_version' => "1.0");
The post to http://api.twitter.com/1/statuses/update.json made with lwp useragent:
'oauth_signature'=>"$signature", 'status'=>'Bientot', 'oauth_consumer_key'=>'blabla', 'oauth_signature_method'=>'HMAC-SHA1', 'oauth_nonce'=>"$nonce", 'oauth_timestamp'=>"$epoch", 'oauth_token'=>"$token_final", 'oauth_version'=>"1.0",
and what i get:
HTTP/1.1 401 Unauthorized Cache-Control: no-cache, max-age=300 Connection: close Date: Wed, 29 Sep 2010 14:36:48 GMT Server: hi Vary: Accept-Encoding WWW-Authenticate: Basic realm="Twitter API" Content-Length: 75 Content-Type: application/json; charset=utf-8 Expires: Wed, 29 Sep 2010 14:41:48 GMT Client-Date: Wed, 29 Sep 2010 14:36:49 GMT Client-Peer: 128.242.240.29:80 Client-Response-Num: 1 Set-Cookie: _twitter_sess=BAh7DjoTc2hvd19oZWxwX2xpbmswOg5yZXR1cm5f +dG8iYWh0dHA6Ly9hcGku%250AdHdpdHRlci5jb20vb2F1dGgvYXV0aG9yaXplP29hdXRo +X3Rva2VuPXpMc2d2%250AV2U5aHBvSWNOSW5rOFFkYUNrN1NQSlozZW1VcUNpckNxWkZv +OhVpbl9uZXdf%250AdXNlcl9mbG93MDoTcGFzc3dvcmRfdG9rZW4iLWZiNzEyNTAzMGNi +YTk1NTU1%250ANDE0OGExM2UxN2U2Yzc1ZmY2YjUzMDE6CXVzZXJpBLWRPgYiCmZsYXNo +SUM6%250AJ0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7AAY6CkB1c2Vk +%250AewA6B2lkIiU0MGUyNmQzNjRmYmI4YThlODgwN2MwZWYzYzNlOGJiYjoMY3Ny%250 +AZl9pZCIlZTUzZjY0OGIxMWZiOTA0OWQzM2FlOGI4NjYzZDA5NTI6D2NyZWF0%250AZWR +fYXRsKwhe%252FkpTKwE%253D--3b624de9adb8de40ff8a3f0a5780f2b18b6abd44; +domain=.twitter.com; path=/ Status: 401 Unauthorized X-Runtime: 0.00264 {"request":"/1/statuses/update.json","error":"Could not authentica +te you."}
Does anyone has an idea ? i'm stuck there, and it's really frustrating... Thanks Regards

In reply to Update twitter status with lwp user agent by albh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.