You can do this with standard system calls. Here's an example in Perl:
use strict; use warnings;
use Socket;
use Data::Dumper;
my @addresses = gethostbyname('google.com');
my @ips = map { inet_ntoa($_) } @addresses[4 .. $#addresses];
print Dumper(\@ips);
produces the output:
$VAR1 = [
'74.125.127.104',
'74.125.127.103',
'74.125.127.105',
'74.125.127.106',
'74.125.127.147',
'74.125.127.99'
];
(On the command-line, the same script can be written as: perl -MSocket -MData::Dumper -wle'my @addresses = gethostbyname("google.com"); my @ips = map { inet_ntoa($_) } @addresses[4 .. $#addresses]; print Dumper(\@ips)'
)
You can do this similarly in other languages -- see the man page for the
system calls at man -s3 gethostbyname
etc.