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

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("", "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("", "Some Realm", "foo", "secret");

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

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1190528]
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
Find Nodes?
    Voting Booth?

    No recent polls found