IP to location
Moderator: General Moderators
-
thosecars82
- Forum Commoner
- Posts: 94
- Joined: Thu Apr 03, 2008 6:31 am
- Location: Arganda, Madrid
- Contact:
IP to location
Hello
I am trying to translate IP addressses into locations.
To begin with, I was looking for a good script to translate an IP address to city and using this script in a website X. I have not found any reliable one yet though.
Moreover, I just found a few websites which might be reliable for this purpose.
On one hand, since these websites do not make their code available I had thought of doing an http request to any of these websites, let's call it Y, in order to get the address corresponding to the IP.
On the other hand, from the point of view of the delay involved, I am not sure whether it would be a good idea this http request to a website Y in order to get content which would be used to display website X.
What do you recommend?
Thanks.
I am trying to translate IP addressses into locations.
To begin with, I was looking for a good script to translate an IP address to city and using this script in a website X. I have not found any reliable one yet though.
Moreover, I just found a few websites which might be reliable for this purpose.
On one hand, since these websites do not make their code available I had thought of doing an http request to any of these websites, let's call it Y, in order to get the address corresponding to the IP.
On the other hand, from the point of view of the delay involved, I am not sure whether it would be a good idea this http request to a website Y in order to get content which would be used to display website X.
What do you recommend?
Thanks.
Last edited by thosecars82 on Wed Apr 06, 2011 3:02 am, edited 1 time in total.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: IP to location
MaxMind has some free geoIp2City databases for download.
And no, it's not a good idea to make external requests on every load.
And no, it's not a good idea to make external requests on every load.
-
thosecars82
- Forum Commoner
- Posts: 94
- Joined: Thu Apr 03, 2008 6:31 am
- Location: Arganda, Madrid
- Contact:
Re: IP to location
Thanks for the advices.John Cartwright wrote:MaxMind has some free geoIp2City databases for download.
And no, it's not a good idea to make external requests on every load.
Is that freeware?
I just forgot to mention that I was looking for the most reliable freeware option.
Last edited by thosecars82 on Thu Oct 14, 2010 4:41 pm, edited 1 time in total.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: IP to location
Like I said, free geoIp2City databasethosecars82 wrote:Is that freeware?
I just forgot to mention that I was looking for the most reliable freeware option.
See http://www.maxmind.com/app/geolitecity
When it comes to GeoIP and free, you have to throw accuracy out the window. They generally do not update their databases frequently, and by nature IP addresses change very frequently (as IP blocks are sold, shifting, etc., sometimes to completely different continents). I don't know what they mean by realibility, you I assume you meant accuracy, and in that case I already touched on that.
-
thosecars82
- Forum Commoner
- Posts: 94
- Joined: Thu Apr 03, 2008 6:31 am
- Location: Arganda, Madrid
- Contact:
Re: IP to location
Thanks for the info.John Cartwright wrote:Like I said, free geoIp2City databasethosecars82 wrote:Is that freeware?
I just forgot to mention that I was looking for the most reliable freeware option.
See http://www.maxmind.com/app/geolitecity
When it comes to GeoIP and free, you have to throw accuracy out the window. They generally do not update their databases frequently, and by nature IP addresses change very frequently (as IP blocks are sold, shifting, etc., sometimes to completely different continents). I don't know what they mean by realibility, you I assume you meant accuracy, and in that case I already touched on that.
Yeah, accuracy is what I meant, and that is what I should have said from the beginning.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: IP to location
I guess I really didn't answer your question. But yes, MaxMind is probably the best "freeware" geoIP out there (beyond external services).
-
thosecars82
- Forum Commoner
- Posts: 94
- Joined: Thu Apr 03, 2008 6:31 am
- Location: Arganda, Madrid
- Contact:
Re: IP to location
Thanks. I believe you did answer my question pretty well. Now I gotta test it.John Cartwright wrote:I guess I really didn't answer your question. But yes, MaxMind is probably the best "freeware" geoIP out there (beyond external services).
Andyou are right, first time you mentioned GeoLite City you said it was free.
-
thosecars82
- Forum Commoner
- Posts: 94
- Joined: Thu Apr 03, 2008 6:31 am
- Location: Arganda, Madrid
- Contact:
Re: IP to location
Can this GeoIP C API from http://www.maxmind.com/app/c work in Windows instead of Linux? If that is the case, how could it be installed in Windows?
I just saw in http://www.maxmind.com/app/php that to make this work in php, this GeoIP C API must be installed.
Thanks
I just saw in http://www.maxmind.com/app/php that to make this work in php, this GeoIP C API must be installed.
Thanks
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: IP to location
Please read the docs more carefully before asking questions.
You are looking at the pure PHP module. It involves simply placing the text file somewhere in your filesystem, and using the functions provided to interface with the database. This option does not involve any extensions or installations.
They do however offer PHP extensions and Apache modules for faster performance, but thats beyond what I'm willing to help you debug (just use their documentation).
You are looking at the pure PHP module. It involves simply placing the text file somewhere in your filesystem, and using the functions provided to interface with the database. This option does not involve any extensions or installations.
They do however offer PHP extensions and Apache modules for faster performance, but thats beyond what I'm willing to help you debug (just use their documentation).
-
thosecars82
- Forum Commoner
- Posts: 94
- Joined: Thu Apr 03, 2008 6:31 am
- Location: Arganda, Madrid
- Contact:
Re: IP to location
Sorry for asking something that was written on the website.
Another question: do you know whether this GeoLite City is useful all over the world. I just asked because I saw the US word mentioned in the following paragraph. I still think it must be usefull no matter the IP's country except for the postal code and area code fields which mightl only work in the US.
"Product Summary: Determine country, state/region, city, US postal code, US area code, metro code, latitude, and longitude information for IP addresses worldwide. The downloadable database is available to established businesses only, please see the availability section below for details."
It seems as if it might only work for the US.
Thanks
Another question: do you know whether this GeoLite City is useful all over the world. I just asked because I saw the US word mentioned in the following paragraph. I still think it must be usefull no matter the IP's country except for the postal code and area code fields which mightl only work in the US.
"Product Summary: Determine country, state/region, city, US postal code, US area code, metro code, latitude, and longitude information for IP addresses worldwide. The downloadable database is available to established businesses only, please see the availability section below for details."
It seems as if it might only work for the US.
Thanks
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: IP to location
From my experiece, it works beyond North America, but the accuracy isn't all that great.
-
thosecars82
- Forum Commoner
- Posts: 94
- Joined: Thu Apr 03, 2008 6:31 am
- Location: Arganda, Madrid
- Contact:
Re: IP to location
I'm getting this warning
Warning: fopen(./GeoIP.dat) [function.fopen]: failed to open stream: the file or the directory does not exist in ...
Any idea?
The code is
and is being used inside of wordpress.
Thanks
Warning: fopen(./GeoIP.dat) [function.fopen]: failed to open stream: the file or the directory does not exist in ...
Any idea?
The code is
Code: Select all
<?php
include("geoip.inc");
$gi = geoip_open("GeoIP.dat",GEOIP_STANDARD);
Thanks
-
thosecars82
- Forum Commoner
- Posts: 94
- Joined: Thu Apr 03, 2008 6:31 am
- Location: Arganda, Madrid
- Contact:
Re: IP to location [SOLVED]
Solved. I just had to use getCWD() in order to set the proper path when calling fopen.thosecars82 wrote:I'm getting this warning
Warning: fopen(./GeoIP.dat) [function.fopen]: failed to open stream: the file or the directory does not exist in ...
Any idea?
The code isand is being used inside of wordpress.Code: Select all
<?php include("geoip.inc"); $gi = geoip_open("GeoIP.dat",GEOIP_STANDARD);
Thanks
Thanks
-
thosecars82
- Forum Commoner
- Posts: 94
- Joined: Thu Apr 03, 2008 6:31 am
- Location: Arganda, Madrid
- Contact:
Re: IP to location
I got another question.
I got different results for the same ip when I used my script (GeoLite) in contrast with http://phpweby.com/services/iplocation which should give the same result becuase this website states they also use the same database GeoLite.
Do you know why I might be getting different results?
Thanks
I got different results for the same ip when I used my script (GeoLite) in contrast with http://phpweby.com/services/iplocation which should give the same result becuase this website states they also use the same database GeoLite.
Do you know why I might be getting different results?
Thanks
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: IP to location
John Cartwright wrote:When it comes to GeoIP and free, you have to throw accuracy out the window. They generally do not update their databases frequently, and by nature IP addresses change very frequently (as IP blocks are sold, shifting, etc., sometimes to completely different continents). I don't know what they mean by realibility, you I assume you meant accuracy, and in that case I already touched on that.