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