in reply to Dyndns.org Updating Client

I tend to use:

use Socket; if ($ip = gethostbyname($domain)) { $ip = inet_ntoa($ip); print "IP address is $ip\n"; } else { print "Could not resolve name.\n"; }

Not amazing, but does the job :) I assume you're going out to "whatismyip.com" because the IP address you want is not the box you run the script on?

Gordon.

Replies are listed 'Best First'.
Re: Re: Dyndns.org Updating Client
by lithron (Chaplain) on Nov 24, 2003 at 20:29 UTC
    I like the code, and the concept. I'll change things when I get home and do an update. I use whatismyip.com because the computer I run the code on is behind a NAT. Then I let the NAT forward ports to my internal computers. Plus, for those that don't have a NAT, it always retrieves the correct world routeable IP address, instead of grabbing the first network card's IP. I believe the above code could easily replace my call to nslookup. Thank you so much :-)