This is what I have so far and for the most part it works with the exception of the population of the second part of the array cant seem to figure out what I am doing wrong
try
{
echo("<br><br><br>");
//$response = $client->__soapCall("track", array('parameters' => $request));
$response = $client ->track($request);
echo("response<br><br><br>");
echo("<br><br><br>");
print_r($response);
the above print_r prints the following array
response
stdClass Object ( [HighestSeverity] => SUCCESS [Notifications] => stdClass Object ( [Severity] => SUCCESS [Source] => wsi ) [TransactionDetail] => stdClass Object ( [CustomerTransactionId] => Track Request v2 using PHP ) [Version] => stdClass Object ( [ServiceId] => trck [Major] => 2 [Intermediate] => 0 [Minor] => 0 ) [DuplicateWaybill] => 1 [TrackDetails] => Array ( [0] => stdClass Object ( [TrackingNumber] => 999999999999 [TrackingNumberUniqueIdentifier] => 3820080201232522684000~9999999999996 [CarrierCode] => FDXG [ShipTimestamp] => 2008-02-08T00:00:00 [DestinationAddress] => stdClass Object ( [City] => Marion [StateOrProvinceCode] => IA [CountryCode] => US ) ) [1] => stdClass Object ( [TrackingNumber] => 999999999999 [TrackingNumberUniqueIdentifier] => 3920080317213924479000~9999999999996 [CarrierCode] => FDXG [ShipTimestamp] => 2008-02-08T00:00:00 [DestinationAddress] => stdClass Object ( [City] => Homestead [StateOrProvinceCode] => PA [CountryCode] => US ) ) [2] => stdClass Object ( [TrackingNumber] => 999999999999 [TrackingNumberUniqueIdentifier] => 4020080406210208884000~9999999999996 [CarrierCode] => FDXG [ShipTimestamp] => 2008-02-08T00:00:00 [DestinationAddress] => stdClass Object ( [City] => Duquesne [StateOrProvinceCode] => PA [CountryCode] => US ) ) [3] => stdClass Object ( [TrackingNumber] => 999999999999 [TrackingNumberUniqueIdentifier] => 4120080410070604055000~9999999999996 [CarrierCode] => FDXG [ShipTimestamp] => 2008-02-08T00:00:00 [DestinationAddress] => stdClass Object ( [City] => Homestead [StateOrProvinceCode] => PA [CountryCode] => US ) ) [4] => stdClass Object ( [TrackingNumber] => 999999999999 [TrackingNumberUniqueIdentifier] => 4220080420204757782000~9999999999996 [CarrierCode] => FDXG [ShipTimestamp] => 2008-04-18T00:00:00 ) ) )
if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR')
{
foreach ($response as $event=>$events)
{
if(is_array($events))
{
echo("Events<br><br><br>");
print_r($events);
the above print_r prints the following
Events
Array ( [0] => stdClass Object ( [TrackingNumber] => 999999999999 [TrackingNumberUniqueIdentifier] => 3820080201232522684000~9999999999996 [CarrierCode] => FDXG [ShipTimestamp] => 2008-02-08T00:00:00 [DestinationAddress] => stdClass Object ( [City] => Marion [StateOrProvinceCode] => IA [CountryCode] => US ) ) [1] => stdClass Object ( [TrackingNumber] => 999999999999 [TrackingNumberUniqueIdentifier] => 3920080317213924479000~9999999999996 [CarrierCode] => FDXG [ShipTimestamp] => 2008-02-08T00:00:00 [DestinationAddress] => stdClass Object ( [City] => Homestead [StateOrProvinceCode] => PA [CountryCode] => US ) ) [2] => stdClass Object ( [TrackingNumber] => 999999999999 [TrackingNumberUniqueIdentifier] => 4020080406210208884000~9999999999996 [CarrierCode] => FDXG [ShipTimestamp] => 2008-02-08T00:00:00 [DestinationAddress] => stdClass Object ( [City] => Duquesne [StateOrProvinceCode] => PA [CountryCode] => US ) ) [3] => stdClass Object ( [TrackingNumber] => 999999999999 [TrackingNumberUniqueIdentifier] => 4120080410070604055000~9999999999996 [CarrierCode] => FDXG [ShipTimestamp] => 2008-02-08T00:00:00 [DestinationAddress] => stdClass Object ( [City] => Homestead [StateOrProvinceCode] => PA [CountryCode] => US ) ) [4] => stdClass Object ( [TrackingNumber] => 999999999999 [TrackingNumberUniqueIdentifier] => 4220080420204757782000~9999999999996 [CarrierCode] => FDXG [ShipTimestamp] => 2008-04-18T00:00:00 ) )
echo("<br><br><br>");
echo("Event<br><br><br>");
print_r($event);
/* The above I assume is suppose to print the event arry but I get nothing for this print
Event
blank
echo("<br><br><br>");
echo("Event echo<br><br><br>");
echo $event .": ".$events."<br />";
Pulling it all together The first portion of the above echo works the second protion does not results below
Event echo
TrackDetails: Array
echo("<br><br><br>");
// list( $Timestamp, $EventDescription ) = $events;
// echo $Timestamp;
// echo $events .": ".$value."<br />";
/* echo $events -> Timestamp . ': ';
echo $events -> EventDescription . ' - ';
echo $events -> Address -> City . ' ';
echo $events -> Address -> StateOrProvinceCode . $newline;
*/
}
else
{
echo $location . $newline;
}
}
printRequestResponse($client);
}
else
{
/* The below is not working need to redo for each on this one also but cannot get the above to work
echo 'Error in processing transaction.'. $newline. $newline;
foreach ($response -> Notifications as $notification)
{
if(is_array($response -> Notifications))
{
echo $notification -> Severity;
echo ': ';
echo $notification -> Message . $newline;
}
else
{
echo $notification . $newline;
}
}
}
writeToLog($client); // Write to log file
} catch (SoapFault $exception) {
printFault($exception, $client);
}