Click to See Complete Forum and Search --> : Reverse Lookup of IP address


nousername
02-20-2009, 01:24 PM
I have an Active Server Page running on a Linux server running the Apache web service, which is designed to send an e-mail message from a contact page.

I want to perform a reverse DNS lookup of the sender's IP address. Currently I am obtaining the sender's IP address using:


Dim senderInternetAddress

'Used to obtain the sender's IP address
senderInternetAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")

If senderInternetAddress = "" Then
senderInternetAddress = Request.ServerVariables("REMOTE_ADDR")
End If


I tried to obtain the hostname for the IP address using the code below:
senderHostName = Request.ServerVariables("HTTP_HOST")

This code only provides the same IP address as the ("REMOTE_ADDR") server variables.

How can I obtain the DNS name for the IP address being obtained using either the ("HTTP_HOST") or ("REMOTE_ADDR") variables.

criterion9
02-20-2009, 02:08 PM
You will need to hook to a reverse DNS service. I'm sure there are some web services you can use for that or use some creative bash scripting since you are on a linux system. A word of warning however, an additional call to a reverse DNS service can slow page load speeds drastically. Unless it is of high importance that you have access to the DNS hostname it would be best to let that run as a separate process such as through an AJAX call after the page has loaded to prevent a bottleneck.