hi there,
am new to this forum, so thanks for listening.
i'm working with third party provided web service which i can't expose publicly unfortunately. however, i've set up the soap client etc and upon calling a particular method and getting the following back in response to doing a print_r on the result:
stdClass Object
(
[GetUserPersDetailsResult] => stdClass Object
(
[IDNo] => 350773
[Title] => Lord
[GivenName] => Andrew
[Surname] => Gunter
[CompanyName] =>
[Addr1] => Some Road
[Addr2] =>
[Addr3] =>
[Suburb] => Some Suburb
[State] => QLD
[PostCode] => 4213
[Country] => au
[Phone1] =>
[Phone2] =>
[Phone3] =>
[Fax] =>
[EmailAddr] => andrewg@xxx.com.au
[SuppressMail] => 1
)
)
i know this is dumb stuff and i know it's not an array but an object but i'm struggling (all night) to try to particular elements (?) from the object. i've tried all manner of things including:
echo $result[3]->Surname; // to get surname
for($i = 0; $i<count($result); $i++) { // trying another way
echo $result[$i]->Surname . "<br>\n";
}
this just gives me a "cannot use object of type stdClass as array" error which i know but didn't think i was trying to do....
i figure i'm being dumb here cos when i do a count($result) i get an answer of "1" when there should be a bunch of elements. can anyone point in me the right direction re iterating through the results and also plucking out one element?
many many thanks,
andrewg.