#!/usr/bin/perl -w use strict; my $niftyid="NIFTYID"; my $niftypass="NIFTYPASS"; my $file="/usr/local/bin/ddns4nifty/ipaddr.txt"; my $wget; my $ipaddr; my $valid; my $oldipaddr; $| = 1; $wget = `wget --secure-protocol=auto -O- -q https://www.atnifty.com/ddns/p13.php`; $wget =~/[0-9]+(\.[0-9]+){3}/; $ipaddr = $&; $wget =~/name="valid" value="[a-zA-Z0-9]+"/; $valid = $&; $valid =~s/name="valid" value="//; $valid =~s/"//; open FH, "<",$file || die "Error: ipaddr.txt $!\n"; $oldipaddr = ; close FH; if($ipaddr eq $oldipaddr){ print "ip address is not changed:$ipaddr\n"; } else{ print "ip addres is changed:$ipaddr\n"; open FH,">",$file|| die "Error: ipaddr.txt $!\n"; print FH "$ipaddr"; close FH; $wget=`wget --secure-protocol=auto -O- -q --http-user=$niftyid --http-passwd=$niftypass --post-data="ipaddress=$ipaddr&nifty_id=&update=newip&valid=$valid" https://gateway.nifty.com/service/g-way/ddns/nifty/secure/config/update.php`; }