The script below will print the real IP address of the internet connection used:
#!/usr/bin/perl -w
#whatismyip.pl - This script uses http://www.whatismyip.com/ service.
use LWP::Simple;
use strict;
my $url = "http://www.whatismyip.com/";
my $content = get($url);
$content =~ s/.*<TITLE>WhatIsMyIP.com - (\d{1,3}?.\d{1,3}?.\d{1,3}?.\d{1,3}?)<\/TITLE>.*/$1/sig ;
print $content;
So, now I can DynDNS from my box instead of my ADSL modem :)
Great hack, but the guys and whatismyip.com made things a bit easier and provided a page that doesn’t need to be cleaned with a regex:
#!/usr/bin/perl -w
#whatismyip.pl – This script uses http://www.whatismyip.com/ service.
use LWP::Simple;
use strict;
my $url = “http://www.whatismyip.com/automation/n09230945.asp”;
my $content = get($url);
print “$content\n”;
Comment by scyon — 20080713 @ 0622