php - how do I read session content xml format with php5 -


i need read session content php. session created shopping cart script called easybasket , need extract data stored in session, can save mysql table. seems data stored in xml format. here content of session:

array (size=3) 'username' => string 'test@gmail.com' (length=21) 'nombre' => string 'joe smith' (length=16) 'basket' => string '<basket version="1.0" timestamp="2013-05-04t12:58:37+00:00"> <items count="2" quantity="4" subtotal="1460" postage="0" total="1460" paypal="yes"     google="no"> <item unit-price="380.00" quantity="2" subtotal="760" postage="0" total="760">   <title>dancer catamaran adults</title>   <price>380.00</price> </item> <item unit-price="350.00" quantity="2" subtotal="700" postage="0" total="700">   <title>dancer catamaran children</title>   <price>350.00</price> </item> 

use simplexml browse content of $_session['basket']

$xml = simplexml_load_string($_session['basket']); 

example :

$xml = simplexml_load_string($_session['basket']); foreach( $xml->items->item $item) {     echo $item['quantity'] . ' - ' . $item->title . '<br>'; } 

output :

2 - dancer catamaran adults 2 - dancer catamaran children 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -