PHP include Variable Fail. So i have problem with php variable inclusion, in php files where i need to call for specific variable in another php file, i dont always get the requested variable. And i dont understand why.
settings.php
<?php
$symbol = 'MUSIC';
$key='xxx';
$secret='xxx';
?>
database.php
<?php
include ('settings.php');
function selected($key, $secret){
$nonce=time();
$uri='https://something.com?key='.$key.'&symbol='.$symbol.'&nonce='.$nonce; //Problem is in here
$sign=hash_hmac('sha512',$uri,$secret);
$ch = curl_init($uri);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('apisign:'.$sign));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$execResult = curl_exec($ch);
$obj = json_decode($execResult, true);
$info = $obj["result"]["info"];
return $info;
info.php
<?php include "balancedb.php";
$url = "https://somthingother.com/";
$fgc = json_decode(file_get_contents($url), true);
$info = selected($key, $secret);
echo "<br>".$symbol."-----------------".$info."<br>";
?>
I get Notice: "Undefined variable: symbol in ..\database.php on line 7" "MUSIC-----------------"
In one place it takes tha variable but in other it doesnt. Why? How to fix that?