Here is another alternative to retrieving your IP address.
I hate shelling out to an external command since I'd rather not assume that the command is there in the first place. A pure Perl way is more attractive to me.#!/usr/bin/perl -w ###################################################################### +## use strict; use LWP::UserAgent; # NOTE: make sure you mimic a browser with the agent name # whatismyip.com specifically returns a 403 error otherwise my $ua = LWP::UserAgent->new(agent=>"Mozilla/5.0"); my $response = $ua->get("http://automation.whatismyip.com/n09230945.as +p"); if ( $response->is_success ) { # this is how I caught the 403 orginal +ly printf "%s\n",$response->decoded_content; } else { printf "Bad Ju-Ju happened:\n\t%s\n",$response->status_line; } #comparison logic from here.
You can also look at this solution that I came up with for dealing with that issue by querying the administrative interface of my WRT54G router.
In reply to Re: Script to Notify of Public IP Change
by blue_cowdawg
in thread Script to Notify of Public IP Change
by Arkevius
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |