-1

Is there a known way to translate XML envelopes to PHP objects? I have

<ns2:programTokenList>
    <attrib>
        <name>{{my.TOKEN}}</name>
        <value>OynzfthKDkYgvnW0qfI0CgtA0ukAmjOttvtLiikxbksf2SFrMop9cpnCRjkl9BBSujpHS6c1cj8gxyxvuT0DR6L3Wra+y9AbFA7SgCO3mLXUXoqGHiX50fCKG5SDpR8CTEtlRICC6PQrdBr/PC03erBIBM7690omWV74WBCHK1T2FzJV6cZvDw==|srJUXaud7gJxWxWyk63Cz2cZIqVzlNkqP58lypIfHtg=</value>
    </attrib>
    <attrib>
        <name>{{my.TOKEN2}}</name>
        <value></value>
    </attrib>
</ns2:programTokenList>

and i need to translate it to a PHP object to pass it in a SOAP request. Is there anything i can use as reference?

mbalparda
  • 199
  • 1
  • 8

1 Answers1

2

You could use simplexml_load_string($xmldata);

This loads the XML as an object which you can manipulate with oop-code.

Jeroen de Jong
  • 337
  • 1
  • 6
  • It is a possible solution, but i need to try first to copy the XML node structure into a PHP array structure because the qty of elements may vary in the future. – mbalparda Oct 15 '14 at 16:09