Get data from array

I am new in webservice. I am consuming a .net webservice in my php application. its working but my result is in dataset form. how can I get data from this. my output is :

Array ( [WebmethodName] => 
    Array ( [schema] => 
       Array ( [element] => 
         Array ( [complexType] => 
            Array ( [choice] => 
              Array ( [element] => 
                Array ( [complexType] => 
                   Array ( [sequence] => 
                      Array ( [element] => 
                        Array ( [0] => Array ( [!name] => G101 [!minOccurs] => 0 ) 
                                [1] => Array ( [!name] => G102 [!minOccurs] => 0 ) 
                                [2] => Array ( [!name] => G103 [!minOccurs] => 0 ) 
                                [3] => Array ( [!name] => G104 [!minOccurs] => 0 )
                                [4] => Array ( [!name] => G105 [!minOccurs] => 0 ) 
                                [5] => Array ( [!name] => G106 [!minOccurs] => 0 ) 
                                [6] => Array ( [!name] => G107 [!minOccurs] => 0 ) 
                                [7] => Array ( [!name] => G108 [!minOccurs] => 0 ) 
                                [8] => Array ( [!name] => G109 [!minOccurs] => 0 ) 
                                [9] => Array ( [!name] => G110 [!minOccurs] => 0 ) 
                                [10] => Array ( [!name] => G111 [!minOccurs] => 0 ) 
                                [11] => Array ( [!name] => G112 [!minOccurs] => 0 ) 
                             ) 
                          ) 
                     ) 
               [!name] => Table 
            ) 
         [!minOccurs] => 0 [!maxOccurs] => unbounded 
         ) 
     ) 
     [!name] => NewDataSet [!msdata:IsDataSet] => true [!msdata:UseCurrentLocale] => true ) [!id] => NewDataSet ) [diffgram] => Array ( [NewDataSet] => Array ( [Table] => Array ( [G101] => 5053.png [G102] => 118 [G103] => .png [G108] => 5055 [G109] => 2014-09-05T14:50:59+05:30 [!diffgr:id] => Table1 [!msdata:rowOrder] => 0 ) ) ) ) )

and i am calling this webservice like this.how can i find result from this.please help me.

<?php

    require_once('lib/nusoap.php');

    $wsdl = "url?wsdl";

    $mynamespace = "http://tempuri.org/";

    $theVariable = array('Id'=> '1022');

    $s = new SoapClient($wsdl,true);


    $result = $s->call('MethodName',array('parameters' =>  $theVariable));

    echo "<h1>Result:</h1>";

    echo "<pre>";


    print_r ($result);

        echo "</pre>";

?>

Your code formatting doesn’t clearly show if the array is nested or single level, but mostly you can get elements from the array using this:

$result['WebmethodName']

If you want to get elements on a deeper level from the array use:

$result['WebmethodName']['schema']['element']

Be careful though. If some index is not set, e.g. ‘schema’ in the last one you will get a Notice: undefined undex error. To avoid this you need a isset() check such as:

if(isset($result['WebmethodName']['schema']['element']){
    $result['WebmethodName']['schema']['element']
}

Those are just examples. Modify them to suit your needs.

I just updated his post to provide better formatting, hopefully that helps :wink: