Jump to content

Retrieving Location from IP address


lunny

Recommended Posts

Using an ip is never very accurate when it comes to determing the users exact location. The mechanism works as follows (in case you wish to implement it):

 

a new ip address is found and a user is requested, to type in his location, this can easily be done through registration (or whenever a user logs in, and his current ip does not match his previous), however most ISP's provide a dynamic ip address to their clients, so you see that the accuracy of the mechanism decreases

 

GeoIP for example contains about a few million addresses, and is more accurate then most systems, however you need to obtain a site license to use their software.

Ok maybe I should explain why I want to do this first,

....

 

Im working a program to catch 'email snoopers', so we create a honeypot link, snooper visits link and we gather their IP address.

 

Now i just need a location, so as u can i cant really ask for their location in the registration

So, a snooper visits a link, you gather it, you get his location, and then what? You ban the ip address? And what if they are working on a dynamic ip address (what they probably are)? Or do you wanna ban a complete pool (e.g.: texas)?

well, as i mentioned before, GeoIP is the most accurate, they have an open-source version, check it out: http://www.maxmind.com/

 

@taith not exactly, that is only possible when they have been using a static ip address, if it is dynamic, it will be pointing you to a wrong location!

the ip's come dynamically from the ISP, however they hold right to them... they all do have an area attached to them... which... indeed isnt infalable... but it would give you the area it comes from, the ISP name, security information, phone numbers, etc...

The problem with the links specified (Which is what im looking for), is that I would have to send anyone using my application to this site. What I would ideally want is to report results from my page. I know I can't get as specific as the above site, but even retrieving just Country/City with PHP code is it possible ?

well if you resolved the hostname then explode it and take the tld and compare it you could get the country

 

i.e.

 

 

user-1-test.nl if you exploded that then compare the extension (.nl) to a list of extensions, stored in an array

you would see its Netherlands,

 

a list of tlds is out there, and this would tell country-but not the area of the country-altho as mentioned before most arent very accurate when it gets to area of the country

 

 

map

  • 1 year later...

Just came across a tutorial on this.

I haven't tried it, but it seems it will work and will be helpful for u.

http://www.ip2location.com/faqs-ip-country.aspx

What it does is converting an ipaddress to ipnumber. Then it searches a database using that ipnumber to find out the location.

It seems the database is free.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.