One way that is useful--especially if you have a local network connected to the net via a NAT box and your external IP is different to your local ip--is to parse it out of a request made to one of the zillions of "What is my IP" pages spread around the net. The address shown below is just the first one google turned up when I searched.
(It would probably not be freindly of us if we all hit this one site. If you want to try this, feed the quoted string above into google, next page 2 or 3 times and then pick one. You might need to tweak the regex a bit.)
#! perl -sw use strict; use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $request = HTTP::Request->new('GET', 'http://www.internet-help.net/ +cgi-bin/ip-address.pl'); my $response = $ua->request($request); print $response->{_content} =~ m/(\d+\.\d+\.\d+\.\d+)/;
In reply to Re: Detecting when my ISP changes my IP
by BrowserUk
in thread Detecting when my ISP changes my IP
by meonkeys
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |