Answer the question
In order to leave comments, you need to log in
What is the problem with (file_get_contents)?
There is this code:
$info = file_get_contents("http://site.ru/check/check.php?domain=".$_SERVER['SERVER_NAME']);
if($info == '0')
{
exit('Лицензия не активна!');
}
Answer the question
In order to leave comments, you need to log in
Good idea from Alexey Ukolov to duplicate the comment from the discussion as a full-fledged answer.
var_dump($info) displayed string(4) "0" to the author.
Here, special attention is not on the displayed "0", but on the number in brackets, which says that this line has 4 bytes. Not one, as would be the case in most encodings for the string "0".
The most obvious is that a BOM tag arrives in the server response. Just 3 bytes of the BOM, then the character 0 byte, that's 4 bytes in the response. But there may be something else - look at the server response with a hexdump. (alternatively, write the answer to a file and look at this file with a hexdump).
'SERVER_NAME'
Name of the host where the current script is running. If the script is running on a virtual host, this will contain the name defined for that virtual host.
if( empty ($info) )
{
exit('Лицензия не активна!');
}
Try like this:
$info = file_get_contents("http://site.ru/check/check.php?domain=".$_SERVER['SERVER_NAME']);
if(intval($info)==0){
}else{
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question