0

I am integrating with an API which returns data in XML format. I receive a response from the API and store it in a variable named $result. How do I access the clientdetails values from the example response below?

<client_get>
  <header>
    <messagetype>Response</messagetype>
    <submissionnumber>563jd94a2jfoi4f</submissionnumber>
  </header>

    <clientdetails>
      <clientid>23373920</clientid>
      <companyname>Testing Test</companyname>
      <accountreference>1133</accountreference>
      <status>LIVE</status>
    </clientdetails>
    <gocardlessdetails>
      <newsignupurl>https://www.url here>
    </gocardlessdetails>

</client_get>
geoffs3310
  • 5,599
  • 11
  • 51
  • 104
ryan
  • 9
  • 3

1 Answers1

-3

If you can call an external process, there are command line splitters out there. One, xmlsplit, has an option to automatically include that header element in each of the split files, but it is commercial. There are also OS XML splitters.

user204427
  • 157
  • 7