F
F
festus132020-06-20 11:28:14
PHP
festus13, 2020-06-20 11:28:14

Price substitution depending on the user's ip?

Hello everyone, I have a small question about the implementation of some functionality on the site.
There is a site where you need to substitute the price depending on the location of the user.
There is a select in which there are 3 points:
1. Russia
2. Europe
3. The rest
And depending on which point is selected and the price is set.
So I found such an api as Sypex Geo, I can make an ajax request to it and get the country code, but it doesn’t display what part of the world it is, sorting through all the countries of Europe doesn’t look very good, so maybe someone knows another API where you can get the user's country and belonging to Europe?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alex_B, 2020-06-25
@festus13

Try the API from BigDataCloud.com . This service returns administrative and geographic data.

If you had the client's coordinates, then you could use their free service: Free Reverse Geocoding API
If you still want to determine it by IP, then this is also possible:
 IP-Address geolocation API

F
freeExec, 2020-06-20
@freeExec

There are just over 50 countries. Go to the wiki and make a list yourself. Or are you one of those who put a separate plugin on leftpad?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question