Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to work out where an IP address if from?

Status
Not open for further replies.

JamesGMills

Programmer
Aug 15, 2005
157
GB
I have recently setup an ecommerce site and I used protx.com for the payment gateway. When you look at detailed information about a payment you see the users IP address and it then also goes on to show you some information as to where it is from.

I wonder how this process is achieved as I am developing a tracking system for hits to sections and hits per month etc and it would also be good to show where the hits are coming from in relation to country, area etc?

Thanks in advance.
 
Sorry. Clicked on the wrong button.

...to fetch records about the registrant of the block of IP addresses to which the address belongs.

The whois databases have both HTTP and whois frontends, so either method is available. It's just that your script will have to parse the return.

The PEAR archive has a class to help deal with this:

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Hummmmm yes that sounds like a good idea about the database but i have just used google to search for a few things and i found a page that took your IP and told you what country you were in. Now it told me i was in the US but i am in the UK so it does not work. (our ISP is a US company i think).

So my other thinking would be that you could use javascript to get teh regional settings fromthe users PC and then send it back to the database?
 
As you have figured out, there is no deterministic way to get this information. All you can get is best guess.

Getting this information from the browser will be problematic. Considering that the world wide web is a platform- and vendor-agnostic environment, I doubt there's any single way to get this information on every platform and browser.

Plus, now you're depending on users to have set their computer's settings correctly.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Yes thats true, very interesting... So the best way to do this is to use the database but then its not going to give perfect results. So i wounder if there is actually a way or if the people who say they can show reports like this are using estimates!

Thanks for the chat... i will go think about this one a little more...
 
Any data of this type will have errors in it, regardless of whether the source is one of the regional registrars or some JavaScript application collecting it from the user's machine.

The regional registrars track the mailing address of the company that has reserved the netblock of the address.

The JavaScript app will require that users have set their regional settings correctly.


You're not going to get deterministic on this one. But unless there is money changing hands, do you have to be?


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Yes I agree... they are all interesting points... problem is i was going to include it in my CMS that i am currently scripting to sell to clients. I guess i could still include this information and note quite clearly that the information is not 100%
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top