I have a script which has output which looks like the following:
Which is something I've not experienced before. Normally the result would be the array and then the stdClass Object
which I convert to an array using (array) $result
. This one seems to be nested an extra 2 times however, so I have no idea how to access it so that I can turn each of those objects into an array.
So what I need to be able to achieve, for example, is that if I use the code echo $orders[0]->customer_id
, the result would be 716
'.
Could anybody please advise? My code is below if required. Thank you very much.
<?php
$client= new SoapClient('*Magento URL*');
$session_id = $client->login((object)array('username' => '*Magento Username*', 'apiKey' => '*Magento Password*'));
try {
$result = $client->salesOrderList((object)array('sessionId' => $session_id->result, 'filters' => null));
$orders = (array) $result;
echo '<pre>', print_r($orders), '</pre>';
} catch (SoapFault $e) {
echo 'Error: ', $e->getMessage(), '<hr>';
}
?>