I am using the following code to get data from a website using Soap.
$client = new SoapClient('http://some.url.here');
class SMSParam {
public $CellNumber;
public $AccountKey;
public $MessageCount;
public $MessageBody;
public $Reference;
}
$parameters = new SMSParam;
$parameters -> AccountKey = "$sms_key";
$parameters -> MessageCount = "25";
$Result = $client->GetIncomingMessages($parameters);
echo "<pre>";
print_r($Result);
echo "</pre>";
Here is a sample of the output:
stdClass Object
(
[GetIncomingMessagesResult] => stdClass Object
(
[SMSIncomingMessage] => Array
(
[0] => stdClass Object
(
[OutgoingMessageID] => data
[Reference] => data
[MessageNumber] => data
[PhoneNumber] => data
[Message] => data
[ReceivedDate] => data
)
[1] => stdClass Object
(
[OutgoingMessageID] => data
[Reference] => data
[MessageNumber] => data
[PhoneNumber] => data
[Message] => data
[ReceivedDate] => data
)
[2] => stdClass Object
(
[OutgoingMessageID] => data
[Reference] => data
[MessageNumber] => data
[PhoneNumber] => data
[Message] => data
[ReceivedDate] => data
)
)
)
)
If only 1 result is returned, I can simply do something like this:
$reference = $result->GetIncomingMessagesResult->SMSIncomingMessage->Reference;
So how would I go about working with multiple results?
Any help would be greatly appreciated.