Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Net::OAuth and POST data

by Anonymous Monk
on Sep 14, 2018 at 16:34 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1222385]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-25 23:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found