How to Get the IP Address of Website Visitors

Posted On 2013-09-02 by dwirch
Tags: Scripting Tutorial Webmaster Related 
Views: 709

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.


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, 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") %> Easy, huh? 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

has posted a total of 193 articles.

Comments On This Post

By: dwirch
Date: 2013-09-05

Umm, yeah. You guys who are emailing me to thank me for the informative post. Well, you might want to take the title "Web Developer" out of your signature line.

If you don't have knowledge of this basic information, you are doing your clients a severe disservice.

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.

Your IP address is:

Before you can post, you need to prove you are human. If you log in, this test goes away.

Code Links