Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
How do I know if a site is prompting me with basic authentication? I am attempting to use LWP to do basic authentication and for some reason it is not working. Running the the following script:
use HTTP::Request::Common qw(POST); use LWP::UserAgent; use strict; my $ua = LWP::UserAgent->new(); my $req = POST 'http://home.sff.net/login.asp', [ username => 'jonatha +nmark', RecordID => 4142]; print "The netloc is" , $req->url->netloc, ". "; $ua->credentials($req->url->netloc, "home.sff.net", 'jonathanmark', 'n +ottherealpassword'); my$content = $ua->request($req)->as_string; print "Content is $content";
produces the following output:
The netloc is: home.sff.net. Content is HTTP/1.0 401 (Unauthorized) Ac +cess Denied Cache-Control: private Date: Fri, 01 Mar 2002 01:46:04 GMT Via: 1.1 Dyn-EH-NetCache (NetCache NetApp/5.1R2) Server: Greyware Web Server WWW-Authenticate: Basic realm="home.sff.net" Content-Length: 24 Content-Type: text/html Client-Date: Fri, 01 Mar 2002 01:48:51 GMT Client-Peer: 208.14.208.55:80 Error: Access is Denied.
If anyone has any idea I would really appreciate it.

In reply to Unable to get LWP Basic Authentication to Work by sierrathedog04

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-03-28 17:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found