How to Get the IP Address of Website Visitors
Now, now. I know most of you are pretty seasoned veterans of technology, and some of you are even top-notch developers. Would you believe someone out there is selling this, though?
Yes, I know. On a particular forum for webmasters and SEO-type folks that I frequent, I saw a marketplace post for a script for sale. The script provided the functionality of revealing the IP address of visitors of your website. And what was he charging for this free information ? Eleven US dollars.
WTF?!Yep, this guy actually has the chutzpah to attempt to charge people for free information. Well, you know I can't just let that stand. So, I'm going to show you how.
Why Should I Know the IP Address of Visitors?Well, in all honesty, there is no real reason for you as a webmaster to know this information. The only time you'd need to know is if you get a subpoena from legal authorities for an investigation. And then their going to ask for your log files, filtered by a specific IP address.
But lets say you're building your own analytics type engine. Or maybe you want to watch for a certain IP address to pop up on your site. Maybe you might want to kick off a certain chain of events of you get a hit from a particular netblock.
Most of time, these scripts are used for "What's My IP Address?" type pages. Heck, fortypoundhead.com has one, located here.
So here is the code. All one line of it. Just for kicks, two different language interpreters.
<% =Request.ServerVariables("REMOTE_ADDR") %>
Now don't go paying money for information that is free. Use your favorite search engine, and save some cash. You can buy me a beer next time you are in town.
About the Author
dwirch has posted a total of 172 articles.
Comments On This Post
Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.
Or you can drop a note to the administrators if you're not sure where you should post.