Question

For my web app, I was wondering how to improve the accuracy of the country lookup based on IP address. Has anyone tried using a number of the API services in parallel and taking a vote, i.e. if 4 out of 5 return 'GB' and one returns 'US' then go with 'GB'. Statistically this should improve accuracy, but that depends on the independence of the IP databases behind each API.

Would this be a feasible approach?

Was it helpful?

Solution

You can maintain database for mapping of IP address to country and check on each request to determine the country associated with IP address.

As IP address's are always assigned country-wise so you wont face any problems following this approach,make sure you update this database from time to time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top