Answer the question
In order to leave comments, you need to log in
How to insert variable in file_get_contents?
Hello, I can't insert a variable into file_get_contents. I've tried
various options, such as depletion, inserting various variables, but nothing helps. This function does not want to take a variable into account.
When the page is loaded, the balance is shown, but when you click on the 'Update' button, it gives an error, the link is written without a token in the variable Update.php
file :
$info = file_get_contents('https://******/api/balance/get?api_token='.$_SESSION['z']['token']);
$info = json_decode($info, true);
echo 'Баланс: <span style="color:yellowgreen">'.$info[data][balance].'</span> | <span style="color:darkred">'.$info[data][frozen].'</span>';
print_r($_SESSION['z']['token']);
<div id="up" style="margin: 0 5px"><?php include "include/update.php" ?></div>
<button id="upClick" class="whiteButton">Обновить</button>
<script type="text/javascript">
$("#upClick").click(function(e){
e.preventDefault();
$("#up").load('include/update.php');
});
</script>
Answer the question
In order to leave comments, you need to log in
Who puts the cookie? If it is not placed in the root of the site (/), you need to prescribe path
path
The path on the server in which the cookie will be available on. If set to '/', the cookie will be available within the entire domain. If set to '/foo/', the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain. The default value is the current directory that the cookie is being set i
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question