biggieuk Posted July 5, 2012 Share Posted July 5, 2012 Hi all, Bit of an odd question. I am using Maxmind GeoIP (http://www.maxmind.com/app/ip-location) to locate the approx location of users. The api returns an object containing longitude and latitude. I now need to use these longitude/latitude values to determine if the user is: England Scotland Wales Republic Ireland Northern Ireland Rest of World An option is to gather the lon/lat of these areas and test if the user is within this range. What would be the best way to go about this? Anyone done anything similar? Thanks for help with this! Quote Link to comment https://forums.phpfreaks.com/topic/265235-geoip-determine-uk-region-via-latitudelongitude/ Share on other sites More sharing options...
haku Posted July 5, 2012 Share Posted July 5, 2012 You are actually better off not converting the IP address to a geolocation, and instead checking if the ip address is in the areas you mentioned. In order to calculate from the geolocation, you'd have to have a plot of points for the borders you specified, and then do some complicated calculations to figure out if you are within those borders. With the IP address, you can check the address against a range for the given countries and determine that way. Quote Link to comment https://forums.phpfreaks.com/topic/265235-geoip-determine-uk-region-via-latitudelongitude/#findComment-1359300 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.