0

I'm getting an XML file and converting to array using:

$myObject = simplexml_load_string(file_get_contents($xmlUrl));

With var_dump I can see the returning object is:

object(SimpleXMLElement)#614 (4) {
  ["@attributes"]=>
  array(5) {
    ["id"]=>
    string(2) "77"
    ["parentCategoryId"]=>
    string(4) "6420"
    ["isFinal"]=>
    string(4) "true"
    ["hasOffer"]=>
    string(4) "true"
    ["hasProduct"]=>
    string(4) "true"
  }
}

I need to get the id. I've already tried $myObject->@attributes, $myObject->attributes and $myObject->{'@attributes'} but no success, the var_dump always return an empty object.

Kevin
  • 41,694
  • 12
  • 53
  • 70
Susana Santos
  • 312
  • 1
  • 6
  • 18
  • Wow it is really duplicated question. I researched before asking, but I was researching for "object starting with special caracter" I did not think it could be something with simplexml Thank you very much. I was almost one hour in this. – Susana Santos Aug 24 '16 at 22:41
  • Do you use twitter ? or teamviewer ? – Hendra Nucleo Aug 25 '16 at 00:09
  • Why are you asking this? – Susana Santos Aug 25 '16 at 14:07
  • To make a work connection. And probably share a knowledge ? – Hendra Nucleo Aug 26 '16 at 16:08
  • I've looked into your recent interactions at stackoverflow. It seems you are only interested to make "networking connections" with females. You are the reason most womem hide themselves under a male nickname. Stop doing this kind of thing. I'm a professional and I demand respect. – Susana Santos Aug 27 '16 at 13:37

0 Answers0