pyro70
pyro70

Reputation: 89

Storing XML object in PHP Session Variables

There are a lot of discussions on this topic but I'd like to ask this question anyways to determine the best approach for my specific situation...

I'm using the linkedIn API with CakePHP. From the LinkedIn API I get an XML object. I would like to store this XML objects (the whole thing) in a session variable so I do not have to call the API on every page. My understanding is that it's not possible to store XML objects in a PHP Session. What is the usual workaround for this?

I've already written a lot of code that reads/manipulates the XML objects, so I'd like to avoid turning the object into an array or something else so that I do not need to rewrite this code.

Many Thanks

Upvotes: 0

Views: 917

Answers (3)

alessioalex
alessioalex

Reputation: 63683

You could save the XML in a file or in the database.

Upvotes: 0

Francis Avila
Francis Avila

Reputation: 31641

Why don't you store the XML object as an XML string? Radical, I know.

Upvotes: 4

jerrygarciuh
jerrygarciuh

Reputation: 22018

What about writing the XML to a temp file with the session id as the filename?

Upvotes: 0

Related Questions