K
K
KRHD2015-12-16 16:49:52
PHP
KRHD, 2015-12-16 16:49:52

How to get the domain of the one who tried file_get_contens to pick up the JSON?

Hello everyone, there is such a script, it checks if there is a domain in the database

$domainCheck = file_get_contents('http://site.ru/check/check.php?domain='.$_SERVER['HTTP_REFERER'].');
if($domainCheck != '1'){exit('LICENSE IS NOT ACTIVATED');}

It is necessary that if someone tries to get json through file_get_contents, which, in the continuation of this script from above, receives the domain from which they access the site

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2015-12-16
@dmitrydeco

$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
echo $hostname;

If it sits under some service (cloudflare), then just forget it. Such checks require other tools.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question