Вопрос

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?

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top