Translate XML to PHP

266

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?

473

Answer

Solution:

You could use simplexml_load_string($xmldata);

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

People are also looking for solutions to the problem: php - Javascript - href action executes on linked page

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.