how to save contents of file in SESSION variable

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
eshban
Forum Contributor
Posts: 184
Joined: Mon Sep 05, 2005 1:38 am

how to save contents of file in SESSION variable

Post by eshban »

Hi , i have a question.

i read the contents of the file by method

Code: Select all

file_get_contents
can i save these contents of file in a SESSION varaible to access it on other page and write the file on that other page.

Please tell me any solution.

Thanks
amir
Forum Contributor
Posts: 287
Joined: Sat Oct 07, 2006 4:28 pm

Post by amir »

Try,

Code: Select all

$_SESSION['sess_avr'] = file_get_contents("http://www.example.com");
and then on another page, get this data through

Code: Select all

$_SESSION['sess_avr'];
Sure start session on each page.

BOL!
Post Reply