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'
In reply to Basic authentication with LWP::UserAgent by abeal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |