Hi, I just got online via a cable modem, yea. I am sitting behind a one port linksys Router and my provider uses DHCP so the router�s IP is liable to change from Time to time... Here is a bit of Perl that can be used to capture the IP from the Router and perhaps mail it off to work :) Just change the admin password below >From the default �admin� in the curl command.
#!/usr/bin/perl # # fetch the current ip address from the linksys router... # Jerry LeVan ([EMAIL PROTECTED]) # Mac OS X 10.1.4 # May 12,2002 # my ($pattern,$thePage,$theAddress,$wan,$ip,$theip); #define the pattern we are looking for... $wan = '^.*<!--WAN head-->.*'; $ip = 'IP Address:</td><td><font face=verdana size=2>'; $theip = '(\d+\.\d+\.\d+\.\d+)</td'; $pattern = $wan.$ip.$theip; # Fetch the page $thePage = `curl -s -u :admin http://192.168.1.1/Status.htm` ; # Look for the current IP embedded in the Status Page if ($thePage =~ m|$pattern|) { $theAddress = $1; print $theAddress,"\n"; # here you could mail the address ... } else { print "Problem getting address...\n"; }
