$_COOOKIE problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pedroz
Forum Commoner
Posts: 99
Joined: Thu Nov 03, 2005 6:21 am

$_COOOKIE problem

Post 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
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
Post Reply