Page 1 of 1

$_COOOKIE problem

Posted: Sun Nov 13, 2005 9:25 am
by pedroz
Please check the following scenario:

Cookie in temporary internet files : OK! from http://www.A.com

tcookie.php from site http://www.A.com

Code: Select all

// http://www.A.com
                echo $_COOKIE['user'].":".time();

index.php from site http://www.B.com

Code: Select all

//www.B.com
                $ch = file("http://www.A.com/tcookie.php");
  		
                // ERROR below: does not display $_COOKIE string
                echo $ch[0];

Any idea to execute index.php and display the cookie?
avoid: include() and require() command

Posted: Sun Nov 13, 2005 12:16 pm
by twigletmac
The main issue is that file() only reads the file into an array and does not execute the code within. Have a look at the eval() function and for simplicities sake probably file_get_contents().

Mac