Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Question about the credentials method in WWW:Mechanize

by paulehr (Sexton)
on Nov 16, 2006 at 03:42 UTC ( [id://584358]=perlquestion: print w/replies, xml ) Need Help??

paulehr has asked for the wisdom of the Perl Monks concerning the following question:

I am doing some scraping using WWW::Mechanize and ran into an issue where the credentials method was not working for me.

While searching for a solution I ran across this node where the original poster was having the same issue I was. Only difference was I had used the credentials method before requesting the page.

One of the monks that replied to the thread had pointed out the use of MIME::Base64 and encoding the user name and password. I had tried the example code and it worked for me. I was able to access the restricted page I was trying to scrape (my Linksys router's web interface).

My question is, how come just using the credentials method not didn't work when trying to access the page? Why did the solution that involved encoding the username/password with MIME::Base64 work? I am really puzzled and wish to understand why one method worked and not the other.

Thanks for the help!

Replies are listed 'Best First'.
Re: Question about the credentials method in WWW:Mechanize
by converter (Priest) on Nov 16, 2006 at 08:01 UTC
    If you do a google search on "rfc http basic authentication base64," among the 441,000 estimated hits will be a link or two to RFC 2617, which describes http authentication. This is an old document and probably obsolete, but I don't think much has changed. To quote the RFC:
    To receive authorization, the client sends the userid and password, separated by a single colon (":") character, within a base64 encoded string in the credentials.
      ahh ok, so what it comes down to is the credentials method that mech uses is pretty much useless?
Re: Question about the credentials method in WWW:Mechanize
by zentara (Archbishop) on Nov 16, 2006 at 12:26 UTC
      I had found that node and tried that as well with no luck. Sorry if my comment came off as kind of harsh. Been working on this script for awhile and was a little frustrated.
Re: Question about the credentials method in WWW:Mechanize
by monarch (Priest) on Nov 16, 2006 at 16:21 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://584358]
Approved by Samy_rio
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-03-19 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found