summaryrefslogtreecommitdiffstats
path: root/bin/get_ip
blob: 879e0cd8c122bc947b2206c7b58bd00b1b81274d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/perl

my $page = "http://www.lawrencegoetz.com/programs/ipinfo/";

open my $site, "wget -qO- $page|" or die "Could not get web page";

my $next_line_is_ip = 0;
while (<$site>) {
    s/[\r\n]+$//;
    if ($next_line_is_ip == 1) {
        s/ //g;
        print $_, "\n";
        last;
    }
    $next_line_is_ip = 1 if /Your IP address is/;
}