title: how to retrieve the values using php variable/array (nusoap)
body: <p><strong>Scenario:</strong> I'm using a nusoap.php and connect to a microsoft web service. It returns a result in an array. And it works.</p>
  
  <p><strong>Problem:</strong> How to retrieve the value of the DeviceId  that is return from the nusoap which is an array? (Because I need to loop this array row by row and get the value of the DeviceId.).</p>
  
  <p>Here's my code: (I print the whole value of an array and the xml) </p>
  
  <pre><code>&lt;?php
  
  require_once('nusoap.php');
  
  $client = new nusoap_client('http://xxx.xxx.xx.xxx:8060/iapps/Service1.asmx?WSDL', true);
  
  $param = array('sql' =&gt;'exec DeviceGet 1 ','p2' =&gt; '');
  $result = $client-&gt;call('GetData',$param , 'Service');
  
  echo print_r($result,true);
  
  echo '&lt;h2&gt;Response&lt;/h2&gt;&lt;pre&gt;' . htmlspecialchars($client-&gt;response, ENT_QUOTES) . '&lt;/pre&gt;';
  ?&gt;  
  </code></pre>
  
  <p>Here's the result:</p>
  
  <pre><code>Array ( [GetDataResult] =&gt; Array ( [schema] =&gt; Array ( [element] =&gt; Array ( [complexType] =&gt; Array ( [choice] =&gt; Array ( [element] =&gt; Array ( [complexType] =&gt; Array ( [sequence] =&gt; Array ( [element] =&gt; Array ( [!name] =&gt; DeviceId [!minOccurs] =&gt; 0 ) ) ) [!name] =&gt; Table1 ) [!minOccurs] =&gt; 0 [!maxOccurs] =&gt; unbounded ) ) [!name] =&gt; NewDataSet [!msdata:IsDataSet] =&gt; true [!msdata:UseCurrentLocale] =&gt; true ) [!id] =&gt; NewDataSet ) [diffgram] =&gt; Array ( [NewDataSet] =&gt; Array ( [Table1] =&gt; Array ( [0] =&gt; Array ( [DeviceId] =&gt; 00000000-0000-1000-8000-000C29BB0EEA [!diffgr:id] =&gt; Table11 [!msdata:rowOrder] =&gt; 0 ) [1] =&gt; Array ( [DeviceId] =&gt; 2f73ba3b80df3636c14e1bafa3818f06d42ebe4d [!diffgr:id] =&gt; Table12 [!msdata:rowOrder] =&gt; 1 ) [2] =&gt; Array ( [DeviceId] =&gt; 448252633b4dde13c4cf0431d4055d69ffc70723 [!diffgr:id] =&gt; Table13 [!msdata:rowOrder] =&gt; 2 ) [3] =&gt; Array ( [DeviceId] =&gt; 731a2f59b54d38df202315cd3853e3272757febd [!diffgr:id] =&gt; Table14 [!msdata:rowOrder] =&gt; 3 ) [4] =&gt; Array ( [DeviceId] =&gt; f855ded29053b276cd99452a454477e5a2d27787 [!diffgr:id] =&gt; Table15 [!msdata:rowOrder] =&gt; 4 ) ) ) ) ) )
  
  Response
  HTTP/1.1 200 OK
  Cache-Control: private, max-age=0
  Content-Type: text/xml; charset=utf-8
  Server: Microsoft-IIS/7.0
  X-AspNet-Version: 2.0.50727
  X-Powered-By: ASP.NET
  Date: Thu, 07 Apr 2011 21:18:12 GMT
  Connection: close
  Content-Length: 1598
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;soap:Body&gt;&lt;GetDataResponse xmlns="http://tempuri.org/"&gt;&lt;GetDataResult&gt;&lt;xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"&gt;&lt;xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true"&gt;&lt;xs:complexType&gt;&lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;&lt;xs:element name="Table1"&gt;&lt;xs:complexType&gt;&lt;xs:sequence&gt;&lt;xs:element name="DeviceId" type="xs:string" minOccurs="0" /&gt;&lt;/xs:sequence&gt;&lt;/xs:complexType&gt;&lt;/xs:element&gt;&lt;/xs:choice&gt;&lt;/xs:complexType&gt;&lt;/xs:element&gt;&lt;/xs:schema&gt;&lt;diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"&gt;&lt;NewDataSet xmlns=""&gt;&lt;Table1 diffgr:id="Table11" msdata:rowOrder="0"&gt;&lt;DeviceId&gt;00000000-0000-1000-8000-000C29BB0EEA&lt;/DeviceId&gt;&lt;/Table1&gt;&lt;Table1 diffgr:id="Table12" msdata:rowOrder="1"&gt;&lt;DeviceId&gt;2f73ba3b80df3636c14e1bafa3818f06d42ebe4d&lt;/DeviceId&gt;&lt;/Table1&gt;&lt;Table1 diffgr:id="Table13" msdata:rowOrder="2"&gt;&lt;DeviceId&gt;448252633b4dde13c4cf0431d4055d69ffc70723&lt;/DeviceId&gt;&lt;/Table1&gt;&lt;Table1 diffgr:id="Table14" msdata:rowOrder="3"&gt;&lt;DeviceId&gt;731a2f59b54d38df202315cd3853e3272757febd&lt;/DeviceId&gt;&lt;/Table1&gt;&lt;Table1 diffgr:id="Table15" msdata:rowOrder="4"&gt;&lt;DeviceId&gt;f855ded29053b276cd99452a454477e5a2d27787&lt;/DeviceId&gt;&lt;/Table1&gt;&lt;/NewDataSet&gt;&lt;/diffgr:diffgram&gt;&lt;/GetDataResult&gt;&lt;/GetDataResponse&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;
  </code></pre>