php ip location
I have a simple question. Is it possible to redirect people in my website by the IP location?
Example: one person navigates on the site and when go to pay, if the ip location is from Portugal pay by bank transfer, if not pay by paypal?
sorry my english. thanks, Pedro Lopes
In the end, it sounds like you only really care about which billing platform to send them to. It is far easier and more reliable to allow your users to select their country from a list of countries you support. This is both more accurate than the IP-based solution and it solves for travelers who may not be at their home computer. There are more potential issues with IP-based location in the link @Piskvor provided in the comments above.
For the example you gave, you could offer your standard billing address form. If the user selects a country other than Portugal, the bank transfer tender type gets disabled, and PayPal is selected.
Of course and you can do it. But I thing that not so accurate.
In example I am from Corfu, Greece. My geolocation is always pointing in Athens Greece.
Another example. I have try to lock out a whole country from accessing my web site for a personal reason. But while that work good, is not perfect, still I have visits from that country.
Yes. It is totally possible to track and redirect based on visitor's IP-Location.
You can use ipgeolocation.io API. It is free for use up to 30K requests per month (1K requests per day). It has integrations available for many languages like PHP, Java, etc.