abeal has asked for the wisdom of the Perl Monks concerning the following question:
I've been scouring the net for an answer on this, but I'm getting no love whatsoever. I'm trying to grab the DHCP WAN address of the moment from my router for publishing on a website. I've run across several scripts so far, but none have worked as of yet. Let me post what I have so far...(disclaimer: I am not new to programming, but I am new to Perl)
#!/usr/bin/perl # Dynamic DNS determining program # # Usage: Ask the router for the WAN address, and post it to # the webp +age. # # require LWP::UserAgent; $in_file = "./WANIP_LOG.txt"; $out_file = "./WANIP_LOG.txt"; $dlinkpwd = '<OMITTED>'; $ua = LWP::UserAgent->new; $ua->credentials('192.168.0.103','192.168.0.103','admin',$dlinkpwd); $req = HTTP::Request->new('GET','http://192.168.0.1/st_devic.html'); $res = $ua->request($req); print $res->status_line; print "\n";
Now, 192.168.0.1 is my router, 192.168.0.103 is the machine the script will be executed from, and st_devic.html is the page I access to retrieve the IP when I'm working through a browser. I keep getting 401 - Unauthorized returned as a status code. Have I missed something? I'll admit, I'm a bit iffy on the realm thing...
Any help would be very much appreciated.
~Aron
20031112 Edit by jeffa: Changed title from 'LWP::UserAgent'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Basic authentication with LWP::UserAgent
by davis (Vicar) on Nov 12, 2003 at 09:51 UTC | |
by abeal (Initiate) on Nov 12, 2003 at 19:07 UTC | |
by davis (Vicar) on Nov 13, 2003 at 09:21 UTC | |
by vek (Prior) on Nov 12, 2003 at 23:31 UTC | |
|
Re: Basic authentication with LWP::UserAgent
by LTjake (Prior) on Nov 12, 2003 at 23:31 UTC | |
by abeal (Initiate) on Nov 14, 2003 at 07:09 UTC |