0

How to convert xml to array in php, how to manipulate the nodes that are inside RoomList. Any suggestions on how I can do this?

       <UREFHotelesTarifas xmlns="http://zafiro.tse.com">
         <Token>10956C8E-E312-4E48-A7BD-09FEB99EEBFD</Token>
        <Preset>xx</Preset>
        <HotelIDLIst>1959,-1</HotelIDLIst>
        <FechaDesde>2017-12-17</FechaDesde>
        <FechaHasta>2017-12-20</FechaHasta>
       <RoomList>
         <Root xmlns="http://test.sytes.net">
            <RoomInfo>
               <AdultNum>2</AdultNum>
              <ChildNum>1</ChildNum>
              <ns1:ChildAges age="2"/>
           </RoomInfo>
        </Root>
     </RoomList>
     <Cupo>1</Cupo>
  </UREFHotelesTarifas>

1 Answer 1

1
$xml = simplexml_load_string($xmlString);
$array = json_decode(json_encode((array) $xml), 1);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.