I have written the following code as a client on Linux in an attempt to understand how a webservice running on a Windows 7 PC works.
<?php $client = new SoapClient("http://192.168.0.10/CISWebService/Mediamanager.asmx?WSDL"); $result = $client->GetSequenceNo(array()); $response_arr = objectToArray($result); // print_r($response_arr); var_dump($response_arr); // $arrlength=count($response_arr); // echo $arrlength; function objectToArray($d) { // var_dump($d); if (is_object($d)) { $d = get_object_vars($d); } var_dump($d); if (is_array($d)) { return array_map(__FUNCTION__, $d); } else { return $d; } } ?>
I get the following returned and displayed via the two var_dump() calls.
array(6) {
["iServerNo"]=>
int(0)
["iClientNo"]=>
int(0)
["bNoLimitDownload"]=>
bool(false)
["dtStartDate"]=>
string(19) "0001-01-01T00:00:00"
["dtEndDate"]=>
string(19) "0001-01-01T00:00:00"
["dtServerTime"]=>
string(19) "0001-01-01T00:00:00"
}
int(0)
int(0)
bool(false)
string(19) "0001-01-01T00:00:00"
string(19) "0001-01-01T00:00:00"
string(19) "0001-01-01T00:00:00"
array(1) {
["GetSequenceNoResult"]=>
array(6) {
["iServerNo"]=>
int(0)
["iClientNo"]=>
int(0)
["bNoLimitDownload"]=>
bool(false)
["dtStartDate"]=>
string(19) "0001-01-01T00:00:00"
["dtEndDate"]=>
string(19) "0001-01-01T00:00:00"
["dtServerTime"]=>
string(19) "0001-01-01T00:00:00"
}
}
I suspect that I need to extract the value of iServerNo and iClientNo from either the returned object or the array created by my copied code.
My question is how do I get these values into individual variables?
In other words I would like to populate $iServerNo and $iClientNo but do not understand how.