ColdFusion Whois client using Jakarta Commons/Net lib

Doug posted a query on the cfguru list asking how he might retrieve whois information using ColdFusion. I mentioned that there are numerous tags (search on google if you want to see them), but that it’s pretty easy to do within ColdFusion if you drop the Jakarta Commons/Net jar into your ColdFusion lib directory (cfusionmx/wwwroot/WEB-INF/lib/):

<cfscript>
  whois = createObject(“java”, “org.apache.commons.net.WhoisClient”);
  whois.init();
  whois.connect(“192.149.252.43”); // whois.arin.net
  WriteOutput(whois.query(“204.212.42.4”)); // your random ip address here
  whois.disconnect();
</cfscript>

Note that the whois service works over port 43, so your server must have outbound access to port 43 (if you’re accessing a server outside your own network, performance would presumably be much better if you ran your own whois server internally).

2 thoughts on “ColdFusion Whois client using Jakarta Commons/Net lib”

Leave a Reply

Your email address will not be published. Required fields are marked *