Realm turned out to be model number of my router (default, changeable). So, after grabbing the realm, the modified version looks like:
#!/usr/bin/perl #use warnings; use strict; use LWP::UserAgent; my $ua = LWP::UserAgent->new(); $ua->credentials("192.168.0.103","DI-614+","admin","<OMITTED>"); my $response = $ua->get("http://192.168.0.1/st_devic.html"); die "Error while getting ", $response->request->uri, " -- ", $response->status_line, "\nAborting" unless $response->is_success; print $response->content, "\n";
Had to comment out the warnings because it wouldn't compile:
Can't locate warnings.pm in @INC (@INC contains: /usr/local/lib/perl5/ +site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 . / +usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503) at ip2.pl li +ne 3. BEGIN failed--compilation aborted at ip2.pl line 3.
I'm still getting the 401 error message with the code above. I've tried changing the first argument to be the router instead (192.168.0.1), with no luck. I know this can be done, for I can access the page through a web browser on the local net, and if I can do that, I should be able to have a script do the same, right?
In reply to Re: Re: Basic authentication with LWP::UserAgent
by abeal
in thread Basic authentication with LWP::UserAgent
by abeal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |