Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Net::OAuth and POST data

by Anonymous Monk
on Sep 14, 2018 at 16:34 UTC ( #1222385=note: print w/replies, xml ) Need Help??


in reply to Re: Net::OAuth and POST data
in thread Net::OAuth and POST data

my $req = HTTP::Request->new; my $ua = LWP::UserAgent->new; my %json; $json{apple} = "foo"; $json{kiwi} = "bar"; my $oauth = Net::OAuth->request('protected resource')->new( consumer_key => "...", consumer_secret => "......", token => ".....", token_secret => ".....", protocol_version => Net::OAuth::PROTOCOL_VERSION_1_0A, signature_method => "HMAC-SHA1", timestamp => time, nonce => int( rand( 2**32 ) ), request_url => ".....", request_method => "POST" ); $oauth->sign; $req->header('Authorization'=>$oauth->to_authorization_header.',realm= +"account"'); $req->content_type('application/json'); $req->header('accept' => 'application/json'); $req->method($oauth->request_method); $req->uri($oauth->request_url); $req->content(encode_json(\%json)); $ua->agent('Mozilla/8.0'); my $response=$ua->request($req);

2018-09-15 Athanasius added code tags

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1222385]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2020-12-03 01:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (49 votes). Check out past polls.

    Notices?