Get a host IP address using ColdFusion

December 11, 2010 by Jean

Here is how to retrieve the IP address of a host using ColdFusion:

function getHostIP(host)
{
    var address=createObject("java", "java.net.InetAddress").getByName(host);
    return address.getHostAddress();
}
writeOutput(getHostIP('www.google.com'));

In: ColdFusion