Get an XML-type object:
$resp = $this->c->execute ($req, $sessionKey);//Get XML object $items= $resp->items;
Then read the value of the object, with $items->item, or $items->item->price, so the operation is inconvenient, does not conform to the habit of PHP operation array.
PHP provides an array method to convert an object to an array, as long as you add (array) to the object that you want to convert.
For example, convert $items->item (objects with many item) to an array:
foreach ($items->item as $item) { $goods []= (array) $item;}
$goods is an array of PHP.
Before conversion:
SimpleXMLElement Object ( [cid] = 50003793 [modified] = 2013-04-18 17:16:25 [Nick] = qq307819623 [Price] = 200.00 [title] + Nokia N97 new licensed) SimpleXMLElement Object ( [CID] + 50024921 [Modified] = 2013-04-18 16:58:06 [Nick] = qq307819623 [pic_url] =>pic.jpg [Price] = 888888.00 [title] = Liu Junzhong) SimpleXMLElement Object ( [cid] = 1512 [modified] = 2013-04-18 16:56:46 [Nick] = qq307819623 [Pic_url] = item_pic.jpg [Price] = 323232.00 [title] = used Hello) simplexmlelement Object ( [cid] = 50012166 [Modified] = > 2013-04-18 15:10:07 [Nick] = qq307819623 [pic_url] =>0-item_pic.jpg [Price] = 32.00 [title] = magnification Radetzky a crazy view of the Dallas law)
After conversion:
Array ([0] = = Array ([CID] = 50003793 [modified] = 2013-04-18 17:16:25 [Nick] = qq307819623 [Price] = 200.00 [title]--Nokia N97 new licensed) [1] = = Array ([cid] = 50024921 [modified] = 2013-04-18 16:58:06 [Nick] = Qq3 07819623 [Pic_url] = pic.jpg [Price] = 888888.00 [title] = Liu Junzhong) [2 ] = = Array ([cid] = 1512 [modified] = 2013-04-18 16:56:46 [Nick] = qq307819623 [Pic_url] =>item_pic.jpg [price] + 323232.00 [title] +-Secondhand Hello ) [3] = = Array ([cid] = 50012166 [modified] = 2013-04-18 15:10:07 [Nick] = qq307819623 [Pic_url] = 0-item_pic.jpg [price] = = 32.00 [title] => ; Magnification Radetzky a crazy view of the Dallas law )