Stephen68 Posted January 19, 2008 Share Posted January 19, 2008 Hello all I have been looking around the net to find some code and I find that I'm stumped. What I'm looking to do is get the ip address (I know how to do this) of the person coming to the page. Once I have this I would like to find out what country/city they came from. I have seen some things out there that say I can do this but I was wondering if there was a fairly easy PHP why to do this. The one PHP class that I did find said I was from Ottawa, Canada and I live in Nova Scotia, Canada. Any help would be great, thanks! Stephen Quote Link to comment https://forums.phpfreaks.com/topic/86734-solved-ip-location/ Share on other sites More sharing options...
Ken2k7 Posted January 19, 2008 Share Posted January 19, 2008 Create a GeoIP database is the only way that I know of. Quote Link to comment https://forums.phpfreaks.com/topic/86734-solved-ip-location/#findComment-443240 Share on other sites More sharing options...
Stephen68 Posted January 19, 2008 Author Share Posted January 19, 2008 How do I go about doing that? any help would be great. Steve Quote Link to comment https://forums.phpfreaks.com/topic/86734-solved-ip-location/#findComment-443248 Share on other sites More sharing options...
Ken2k7 Posted January 19, 2008 Share Posted January 19, 2008 Dude, there is little to no chance of you creating one. You can download the database Download Quote Link to comment https://forums.phpfreaks.com/topic/86734-solved-ip-location/#findComment-443252 Share on other sites More sharing options...
resago Posted January 19, 2008 Share Posted January 19, 2008 couldn't you use whois? Quote Link to comment https://forums.phpfreaks.com/topic/86734-solved-ip-location/#findComment-443292 Share on other sites More sharing options...
toplay Posted January 19, 2008 Share Posted January 19, 2008 The one PHP class that I did find said I was from Ottawa, Canada and I live in Nova Scotia, Canada. If you don't like that level of inaccuracy, then don't even start this task/project. IP geo location databases are more accurate at specifying the country (and not the city). In case you're not aware, users could be coming from IP's that are not really where they are located (i.e. they could use a proxy like http://www.proxywb.com). So, what is it you're intending to do? This is a free IP (country) database: http://software77.net/cgi-bin/ip-country/geo-ip.pl There's paid services that you can use in real time. MaxMind boasts about an 80% accuracy (for the US): http://www.maxmind.com/app/city http://www.fraudlabs.com/ip2location.aspx Quote Link to comment https://forums.phpfreaks.com/topic/86734-solved-ip-location/#findComment-443338 Share on other sites More sharing options...
Stephen68 Posted January 19, 2008 Author Share Posted January 19, 2008 I was making a stats tracking page for a website and they asked me is I could display such information for them. So I'll just download the free DB and work with it, I figured there would be a high level inaccuracy. I guess at least I'll give it a try and see if they like it. Thanks for the help all Stepehn Quote Link to comment https://forums.phpfreaks.com/topic/86734-solved-ip-location/#findComment-443417 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.