php ip location

佐手、 提交于 2019-12-08 01:54:57

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/7609083/php-ip-location

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!