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

Question on LWP::UserAgent attribute - $ua->credentials()

by Anonymous Monk
on Jul 05, 2006 at 10:42 UTC ( #559295=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks, Does anyone have a working example of the LWP::UserAgent attribute of $ua->credentials($realm,$uname,$passwd) ? I tried with: $ua->credentials($url, $username, $password); but am still getting the error 407 proxy authentication required. Many thanks in advance!

Comment on Question on LWP::UserAgent attribute - $ua->credentials()
Re: Question on LWP::UserAgent attribute - $ua->credentials()
by marto (Chancellor) on Jul 05, 2006 at 11:04 UTC
    Anonymous Monk,

    Perhaps you could detail exactly what you are trying to do? It sounds as to you are behind a proxy and are trying to access a page which required user authentication. You may want to look at the Proxy attributes in the LWP::UserAgent documentation. If this is no help, please post the complete code you have, the error message (in full) and a better description of your circumstances (for example, are you behind a proxy server that requires a username and password before you can view webpages) and what you are trying to achieve. Also please read the PerlMonks FAQ and How do I post a question effectively? if you have not already done so.

    Martin

      I have to agree, with marto here. You are saying you are getting a proxy error and you asking for help with credentials. Seems like two seperate issues. if you are positive that it is a credentials issues, here is a snippet that works for me,

      my $server = 'www.yourhosthere.com:'; my $port_no = 443; my $realm = 'Restricted Area'; # Make sure the text is an exact matc +h my $user = 'username'; my $passwd = 'password'; $ua->credentials( $server . $port_no, $realm, $user, $passwd );
Re: Question on LWP::UserAgent attribute - $ua->credentials()
by madtoperl (Monk) on Jul 05, 2006 at 12:08 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://559295]
Approved by Hue-Bond
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2014-04-21 11:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (493 votes), past polls