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

Re: lwp authorization

by haukex (Archbishop)
on May 18, 2017 at 12:26 UTC ( #1190528=note: print w/replies, xml ) Need Help??


in reply to lwp authorization

$req->header('Authorization' => "Basic" .encode_base64('cv23gwyzqvur:ty7idfphrkl'));

I would suggest that you don't try to set your own headers, have a look at the LWP::UserAgent docs for the credentials method instead, e.g.:

$ua->credentials("www.example.com:80", "Some Realm", "foo", "secret");

Note that if you wanted to debug this, one way would be to use Wireshark to capture both a successful authentication via the browser and a failed one from your script.

Replies are listed 'Best First'.
Re^2: lwp authorization
by bigup401 (Pilgrim) on May 18, 2017 at 13:10 UTC

    i know this method but cant use

    $ua->credentials("www.example.com:80", "Some Realm", "foo", "secret");

    and gain post request to other url, its single request link

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2022-08-17 08:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?