Reverse IP Address Lookup with ColdFusion + Java
January 10, 2007

I needed to do a reverse lookup on some IP addresses in a database today. I found that you can do this pretty easily with java, and just as easily with ColdFusion. Here it is:
<cfset inet_address = CreateObject("java", "java.net.InetAddress")>
<cfset host_name = inet_address.getByName("66.249.66.99").getHostName()>
<cfoutput>#host_name#</cfoutput>
In java this would simply be:
System.out.println( java.net.InetAddress.getByName("66.249.66.99").getHostName() );
Related Entries
- DNS Query with ColdFusion - October 27, 2005
- CFML on Google App Engine for Java - April 10, 2009
- Serializing CFC's in ColdFusion 8 - August 6, 2007
- Null Java References in CF 6 vs 7 - January 10, 2006
- Thread Priority, and Yielding - April 6, 2005
Trackbacks
Trackback Address: 618/B2C48C72FA8826EB3A8686F940EC781B
Comments
On 01/10/2007 at 2:29:22 PM EST Fernando S. Trevisan wrote:
1
Or you could use:
<cfscript> writeOutput(CreateObject("java", "java.net.InetAddress").getByName("66.249.66.99").getHostName()); </cfscript>
[ ]'s great post =)
On 01/10/2007 at 2:52:25 PM EST Fernando S. Trevisan wrote:
2
OR: <cfoutput>#CreateObject("java", "java.net.InetAddress").getByName("66.249.66.99").getHostName()#</cfoutput>
As well =))
On 01/10/2007 at 3:55:05 PM EST Pete Freitag wrote:
3
Right on Fernando - I wasn't trying to make it look easier in java, but after reading the post again some might have come away with that. The same shortcuts I used in the java example could be used in ColdFusion as you did, above.
On 01/10/2007 at 4:56:26 PM EST Scott F Stroz wrote:
4
Wow. I had a need for using the InetAddress Java class today as well. I planned on blogging it, but you beat me to it.
On 01/11/2007 at 2:29:26 AM EST sagepowder wrote:
5
Has anyone ever done business with http://www.javacitywarehouse.com They
On 01/11/2007 at 6:49:03 AM EST Adam Howitt wrote:
6
We also use inet_address.getLocalHost().getCanonicalHostName() for one of our sites in a cluster so if a client has an issue we can have them view source and read out the machine name.
On 02/10/2007 at 3:20:42 PM EST Lucian wrote:
7
http://www.ipgp.net is a good tool to view information about ip addresses
On 02/27/2007 at 3:02:18 PM EST fira wrote:
8
why not use this accurate ip address locator: http://www.ip-adress.com
Post a Comment
Recent Entries
- Cache Template in Request Setting Explained
- What Version of Java is ColdFusion Using?
- ColdFusion 9 Performance Brief from Adobe
- Request Filtering in IIS 7 Howto
- J2EE Session Cookies on ColdFusion / JRun
- Hands on ColdFusion Security Training
- ColdFusion 9 Solr Vulnerability - Are you at Risk?
- FCKEditor Year 2010 Bug for Firefox 3.6 with ColdFusion
<cfscript> writeOutput(CreateObject("java", "java.net.InetAddress").getByName("66.249.66.99").getHostName()); </cfscript>
[ ]'s great post =)
As well =))



add to del.icio.us



