View Full Version : Getting individual information from XML array

12-10-2010, 01:56 AM
Mods, sorry for the double post, but I realized this is more of a PHP question than an XML question! I am trying to pull the individual pieces out of an xml array here is my php to get the xml:


$response = file_get_contents($url);
$parsed_xml = simplexml_load_string($response);


And here is my XML (as shown by the var_dump):

object(SimpleXMLElement)#1 (3) {
array(2) {
string(2) "ok"
string(2) "11"
object(SimpleXMLElement)#2 (1) {
array(2) {
string(4) "3670"
string(11) "Website"
object(SimpleXMLElement)#3 (3) {
array(1) {
string(10) "bookprices"
object(SimpleXMLElement)#4 (13) {
string(10) "0132080230"
string(13) "9780132080231"
string(28) "Microeconomics (7th Edition)"
string(33) "Robert Pindyck - Daniel Rubinfeld"
string(9) "Hardcover"
string(6) "166.67"
string(3) "768"
string(13) "Prentice Hall"
string(10) "2008-06-21"
string(1) "7"
string(5) "58345"
string(3) "3.5"
string(60) "http://ecx.images-amazon.com/images/I/51GLbJmZclL._SL75_.jpg"

So what is the syntax to pull out book=>edition and echo it for example? I am really struggling with this. :confused:

12-10-2010, 11:04 AM
It'd be easy if you give the contents of the xml file instead of var_dump() result