I hope this is the correct forum to post this topic.
I wonder how to determine the location of a visitor. Sometimes I see some kind of ads like 'Chat with other members from Zwijndrecht' (a location nearby, perhaps my Internet Providor servers location) on a website where I don't even subscribed.
So is there some kind of range of IP addresses by country with the locations or ...
This is done by comparing the IP address of the HTTP request to an IP-to-location database (see the $_SERVER['REMOTE_ADDR'] super-global variable). You can google on something like "IP geolocation database" to find what is currently available.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
You can not tell a persons location by the IP address alone.
My internet connection ALWAYS says I am in Birmingham when the fact is I am more than a 2 hour drive away in another city.
People putting faith in this GeoIP thing are wasting time and effort on something that has never been accurate at all. Until the time were all running on IPv6, this GeoIP location thing WILL NEVER WORK.
I have been with several ISP's in as many years, when I was with BT-Yahoo, my internet connection always showed me as being an american connection in NY. When I was with BT-Broadband, my connection again showed me up as being an american connection. When I was with Ntl, my connection always showed up as a London connection.
This current ISP that I have shows me being a connection in Birmingham.
I do live in the midlands, UK but I don't live in Birmingham, never lived in london, never set foot in the USA... SO why is something that people put so much faith in being accurate so wrong?
IMHO wait for IPv6 to be fully implemented until you throw all your money in to the GeoIP basket.
Well, currently GeoIP location is the only thing to go on (and although it is rarely very accurate to the city, I've found it to be largely accurate on the country level), so saying "wait for IPv6" isn't really a solution. Something like the GeoIP Lite database for example is 99.5% accurate which is infinitely better than the 0% you get from doing nothing.