I have three pages: index.php
, config.php
, test.php
.
I'm trying to grab a value from a saved cookie $_COOKIES['ID']
, although when I'm on the index.php
and I use file_get_contents
to grab test.php
, I get the error of:
Notice: Undefined index: id
But when I go to the page itself myurl.com/files/test.php
, the cookie shows.
In index.php
my code is:
<?php
include "files/config.php";
echo $template;
?>
In files/test.php
, I'm trying to grab a saved cookie
<?php
include "config.php";
echo $_COOKIES['ID'];
?>
config.php
<?php
$template = file_get_contents('files/test.php');
$keywords = array
(
//Site details
"{TITLE}" => 'Hello',
);
foreach($keywords as $search => $data){
$template = str_replace($search, $data, $template);
}
?>