How do I limit which countries can view my website ( PHP )

后端 未结 6 2080
盖世英雄少女心
盖世英雄少女心 2020-12-30 07:44

In there an easy way to do this in PHP. I want to make sure that only web requests from certain countries are able to access my website.

Any ideas?

6条回答
  •  天涯浪人
    2020-12-30 08:11

    Use an IP geolocation database (some are free) and $_SERVER["REMOTE_ADDR"] to get the visitor's IP address.

    http://www.maxmind.com/app/geolitecity is a free (less accurate) version of a commercial one.

提交回复
热议问题