How to access your website only from specific domains?

I need to get a simple server that will be accessed the sites. A list of sites known, only need some way to find these sites, and if the domain is not on the list to do anything.

The first and only that came to mind - to find out the ip ($_SERVER['REMOTE_ADDR']), then to hostnam (gethostbyaddr(ip)) and look for it in the list. Will it work as it should?

PS. Of course, before writing the question, I also smell really good. Made 2 website to webhost. On one write in a file all of the connecting IP and hostname, and on the other сURL'om request first. As a result, the file is - 2a02:4780:bad:19:fced:1ff:fe19:2 : 2a02:4780:bad:19:fced:1ff:fe19:2 (???)
June 10th 19 at 16:16
0 answer

Find more questions by tags Computer networksPHP