title: Get a value from SimpleXML from SOAP api response using PHP
body: <p>I am trying to get a value from SimpleXML SOAP api response using PHP.</p>
  <p>This is the PHP code</p>
  <pre><code>&lt;?php
  $ch = curl_init();
  
  curl_setopt($ch, CURLOPT_URL, &quot;http://micros-hosting.com/EGateway/SimphonyPosApiWeb.asmx&quot;);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  curl_setopt($ch, CURLOPT_HEADER, FALSE);
  
  curl_setopt($ch, CURLOPT_POST, TRUE);
  
  curl_setopt($ch, CURLOPT_POSTFIELDS, &quot;&lt;soap:Envelope xmlns:xsi=\&quot;http://www.w3.org/2001/XMLSchema-instance\&quot; xmlns:xsd=\&quot;http://www.w3.org/2001/XMLSchema\&quot; xmlns:soap=\&quot;http://schemas.xmlsoap.org/soap/envelope/\&quot;&gt;
    &lt;soap:Body&gt;
      &lt;GetConfigurationInfo xmlns=\&quot;http://micros-hosting.com/EGateway/\&quot;&gt;
        &lt;vendorCode /&gt;
        &lt;employeeObjectNum&gt;90009&lt;/employeeObjectNum&gt;
        &lt;configurationInfoType&gt;
          &lt;int&gt;1&lt;/int&gt;
        &lt;/configurationInfoType&gt;
        &lt;revenueCenter&gt;11&lt;/revenueCenter&gt;
        &lt;configInfoResponse /&gt;
      &lt;/GetConfigurationInfo&gt;
    &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;&quot;);
  
  curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    &quot;Content-Type: text/xml;&quot;,
    &quot;SOAPAction: http://micros-hosting.com/EGateway/GetConfigurationInfo&quot;
  ));
  
  $response = curl_exec($ch);
  
  curl_close($ch);
  
  
  $xml = simplexml_load_string($response, NULL, NULL, &quot;http://micros-hosting.com/EGateway/&quot;);
  $ns = $xml-&gt;getNamespaces(true);
  $soap = $xml-&gt;children($ns['soap']);
  $res = $soap-&gt;Body-&gt;children();
  print_r($res);
  </code></pre>
  <p>This is the response</p>
  <pre><code>SimpleXMLElement Object
  (
      [GetConfigurationInfoResponse] =&gt; SimpleXMLElement Object
          (
              [configInfoResponse] =&gt; SimpleXMLElement Object
                  (
                      [OperationalResult] =&gt; SimpleXMLElement Object
                          (
                              [Success] =&gt; true
                              [ErrorCode] =&gt; Success
                              [ErrorMessage] =&gt; Success
                          )
  
                      [ConfigInfoType] =&gt; SimpleXMLElement Object
                          (
                              [EConfigurationInfoType] =&gt; MENUITEMDEFINITIONS
                          )
  
                      [MenuItemDefinitions] =&gt; &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;?micros-type Micros.PosCore.DataStore.DbRecords.DbMenuItemDefinition[], PosCore, Version=2.5.0.0, Culture=neutral, PublicKeyToken=null?&gt;&lt;ArrayOfDbMenuItemDefinition xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;&lt;DbMenuItemDefinition&gt;&lt;NameOptions&gt;0000000&lt;/NameOptions&gt;&lt;MenuItemDefID&gt;3740&lt;/MenuItemDefID&gt;&lt;HierStrucID&gt;23&lt;/HierStrucID&gt;&lt;MenuItemMasterID&gt;1572&lt;/MenuItemMasterID&gt;&lt;SequenceNum&gt;1&lt;/SequenceNum&gt;&lt;Name1&gt;&lt;StringNumberId&gt;7848&lt;/StringNumberId&gt;&lt;StringText&gt;=Salad &amp;amp; Appetizers=&lt;/StringText&gt;&lt;/Name1&gt;&lt;Name2&gt;&lt;StringNumberId&gt;7849&lt;/StringNumberId&gt;&lt;StringText /&gt;&lt;/Name2&gt;&lt;SluSort&gt;0&lt;/SluSort&gt;&lt;NluNumber&gt;0&lt;/NluNumber&gt;&lt;Tare&gt;0&lt;/Tare&gt;&lt;Surcharge&gt;0&lt;/Surcharge&gt;&lt;IconNumber&gt;0&lt;/IconNumber&gt;&lt;OptionBits&gt;00000000&lt;/OptionBits&gt;&lt;SpecialCount&gt;0&lt;/SpecialCount&gt;&lt;PrepTime&gt;0&lt;/PrepTime&gt;&lt;Name3&gt;&lt;StringNumberId&gt;0&lt;/StringNumberId&gt;&lt;StringText /&gt;&lt;/Name3&gt;&lt;LongDescriptor&gt;&lt;StringNumberId&gt;0&lt;/StringNumberId&gt;&lt;StringText /&gt;&lt;/LongDescriptor&gt;&lt;MenuItemClassObjNum&gt;0&lt;/MenuItemClassObjNum&gt;&lt;NluGroupIndex&gt;0&lt;/NluGroupIndex&gt;&lt;SluIndex&gt;0&lt;/SluIndex&gt;&lt;HhtSluIndex&gt;0&lt;/HhtSluIndex&gt;&lt;MainLevels&gt;00000000&lt;/MainLevels&gt;&lt;SubLevels&gt;00000000&lt;/SubLevels&gt;&lt;PosRef&gt;0&lt;/PosRef&gt;&lt;PrintClassObjNum&gt;0&lt;/PrintClassObjNum&gt;&lt;PrefixLevelOverride&gt;0&lt;/PrefixLevelOverride&gt;&lt;GuestCount&gt;0&lt;/GuestCount&gt;&lt;MenuLevelEntries /&gt;&lt;DefaultCondiments /&gt;&lt;NextScreen /&gt;&lt;MiMasterObjNum&gt;10030000&lt;/MiMasterObjNum&gt;&lt;CheckAvailability&gt;false&lt;/CheckAvailability&gt;&lt;OutOfMenuItem&gt;false&lt;/OutOfMenuItem&gt;&lt;/DbMenuItemDefinition&gt;&lt;DbMenuItemDefinition&gt;&lt;NameOptions&gt;0000000&lt;/NameOptions&gt;&lt;MenuItemDefID&gt;3741&lt;/MenuItemDefID&gt;&lt;HierStrucID&gt;23&lt;/HierStrucID&gt;&lt;MenuItemMasterID&gt;2090&lt;/MenuItemMasterID&gt;&lt;SequenceNum&gt;1&lt;/SequenceNum&gt;&lt;Name1&gt;&lt;StringNumberId&gt;7850&lt;/StringNumberId&gt;&lt;StringText&gt;Chicken caesar salad&lt;/StringText&gt;&lt;/Name1&gt;&lt;Name2&gt;&lt;StringNumberId&gt;7851&lt;/StringNumberId&gt;&lt;StringText /&gt;&lt;/Name2&gt;&lt;SluSort&gt;0&lt;/SluSort&gt;&lt;NluNumber&gt;0&lt;/NluNumber&gt;&lt;Tare&gt;0&lt;/Tare&gt;&lt;Surcharge&gt;0&lt;/Surcharge&gt;&lt;IconNumber&gt;0&lt;/IconNumber&gt;&lt;OptionBits&gt;00000000&lt;/OptionBits&gt;&lt;SpecialCount&gt;0&lt;/SpecialCount&gt;&lt;PrepTime&gt;0&lt;/PrepTime&gt;&lt;Name3&gt;&lt;StringNumberId&gt;0&lt;/StringNumberId&gt;&lt;StringText /&gt;&lt;/Name3&gt;&lt;LongDescriptor&gt;&lt;StringNumberId&gt;0&lt;/StringNumberId&gt;&lt;StringText /&gt;&lt;/LongDescriptor&gt;&lt;MenuItemClassObjNum&gt;1000&lt;/MenuItemClassObjNum&gt;&lt;NluGroupIndex&gt;0&lt;/NluGroupIndex&gt;&lt;SluIndex&gt;4&lt;/SluIndex&gt;&lt;HhtSluIndex&gt;0&lt;/HhtSluIndex&gt;&lt;MainLevels&gt;11111111&lt;/MainLevels&gt;&lt;SubLevels&gt;11111111&lt;/SubLevels&gt;&lt;PosRef&gt;0&lt;/PosRef&gt;&lt;PrintClassObjNum&gt;503&lt;/PrintClassObjNum&gt;&lt;PrefixLevelOverride&gt;0&lt;/PrefixLevelOverride&gt;&lt;GuestCount&gt;0&lt;/GuestCount&gt;&lt;MenuLevelEntries /&gt;&lt;DefaultCondiments /&gt;&lt;NextScreen /&gt;&lt;MiMasterObjNum&gt;10030002&lt;/MiMasterObjNum&gt;&lt;CheckAvailability&gt;false&lt;/CheckAvailability&gt;&lt;OutOfMenuItem&gt;false&lt;/OutOfMenuItem&gt;&lt;/DbMenuItemDefinition&gt;&lt;/ArrayOfDbMenuItemDefinition&gt;
                  )
          )
  )       
  </code></pre>
  <p>I need get a value from MenuItemDefinitions response XML. How can I get a get a value from SimpleXML? Can someone help me on this?</p>