Sifmole has asked for the wisdom of the Perl Monks concerning the following question:
Hey all,
I am trying to set up a short Mecahnize script to request a page, but for some reason the passing of credentials isn't doing what I expect. The reponse I get seems to be implying that the credentials are not getting passed.
Here is the code I am using:
1) I know the URL is correct
2) I know the username and password combination is correct.
Any help you call can provide is appreciated.
Here is the code I am using:
Result:#!/usr/local/bin/perl -w use WWW::Mechanize; use strict; my $mech = WWW::Mechanize->new( ); my $url = 'https://mybox/bin/engine.cgi'; my $base = 'https://mybox'; my $username = 'foo'; my $password = 'foo'; $mech->credentials($base, $username, $password); $mech->get( $url ); use Data::Dumper; print Dumper($mech);
Two items:HTML><HEAD> <TITLE>401 Authorization Required</TITLE> </HEAD><BODY> <H1>Authorization Required</H1> This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn\'t understand how to supply the credentials required.<P> <HR> <ADDRESS>Apache/1.3.28 Server at [ip address] Port 443</ADDRESS> </BODY></HTML>
1) I know the URL is correct
2) I know the username and password combination is correct.
Any help you call can provide is appreciated.
Edit: fixed code so that is matches what I really had ( both netlocs matching ).
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: WWW:::Mechanize and credentials
by brian_d_foy (Abbot) on Mar 09, 2005 at 15:35 UTC | |
by petdance (Parson) on Mar 10, 2005 at 17:41 UTC | |
Re: WWW:::Mechanize and credentials
by saintmike (Vicar) on Mar 09, 2005 at 15:29 UTC | |
Re: WWW:::Mechanize and credentials
by Limbic~Region (Chancellor) on Mar 09, 2005 at 15:52 UTC | |
by petdance (Parson) on Mar 10, 2005 at 17:42 UTC | |
Re: WWW:::Mechanize and credentials
by Sifmole (Chaplain) on Mar 09, 2005 at 16:09 UTC | |
by Anonymous Monk on Dec 19, 2013 at 08:44 UTC |
Back to
Seekers of Perl Wisdom