Sorry, how to I generate a dump of my request with Perl?
On Sep 3, 9:41 am, Tom van der Woerdt <[email protected]> wrote: > On 9/3/10 12:28 AM, Lars wrote:> Why aren't my answers to Tom being displayed? > > No idea. > > > I based my program on the exmaples I found > > underhttp://apiwiki.twitter.com/OAuth-Examples > > especially on the example of Scott > > Carterhttp://www.social.com/main/twitter-oauth-using-perl/. > > I followed his comment: > > > # Add padding character to make a multiple of 4 per the > > # requirement of OAuth. > > $signature .= "="; > > As long as the amount of characters is a multiple of 4, it's fine. :) > > >> I also noticed that you don't URL encode the values in $content. If I > >> recall correctly, you have to URL encode those as well. > > > I think I do encode them with > > > my $signature_base_str = "POST&" . uri_escape_RFC3986($api_url) . > > "&" . uri_escape_RFC3986($content); > > > correct? > > No, you need to urlencode the key/value as well, and later urlencode the > complete body. > > >> If that was not the issue, then please show your Base String and the > >> HTTP request. > > > This is the base string: > > > POST&http%3A%2F2Fapi.twitter.com%2F1%2Fstatuses > > %2Fupdate.json&oauth_consumer_key%3DXXX%26oauth_nonce > > %3D10000000001%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp > > %3D1272325550%26oauth_token%3DXXX%26oauth_version%3D1.0%26status > > %3DHello%20world > > Quoting my validator (http://quonos.nl/oauthTester/) : > # Bad URL encoding! > # Both key and value in the POST body need to be URL encoded. > > > > > What do you mean with show us the HTTP request. I think I am doing the > > HTTP request with > > > my $ua = LWP::UserAgent->new; > > my $req = POST($api_url => [ > > 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 > > ]); > > > # Make the request > > my $res = $ua->request($req); > > Actually I meant a dump of the request you make, like the "POST > /endpoint HTTP/1.1" part, including headers. > > Tom > > > On 3 Sep., 00:23, Lars <[email protected]> wrote: > >> Sorry, I don't habe shell access... > > >> On 3 Sep., 00:20, Marc Mims <[email protected]> wrote: > > >>>> I am not a Perl expert but I have developed a small web page with Perl > >>>> which is somewhat popular in Germany (according to Alexa trafic rank < > >>>> 1000). And this web site is tweeting important events using its own > >>>> twitter account. > > >>>> I tried for days but I am not able to get it working (tweeting) again. > > >>>> I registered my web page/application and want to use my access tokens > >>>> "oauth_token" and "oauth_token_secret" which I find under my > >>>> application settings because I am using only this twitter account to > >>>> tweet (seehttp://dev.twitter.com/pages/oauth_single_token) > > >>>> But the response is always "401 Unauthorized"! > > >>>> Any ideas? > > >>>> My Perl program looks like this (my provider does not offer the module > >>>> NET::Twitter) > > >>> If you have shell access, you can probably install local::lib using the > >>> bootstrap method, then install Net::Twitter or Net::Twitter::Lite in > >>> your own directory. > > >>> -Marc -- Twitter developer documentation and resources: http://dev.twitter.com/doc API updates via Twitter: http://twitter.com/twitterapi Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list Change your membership to this group: http://groups.google.com/group/twitter-development-talk?hl=en
