I trying to get values of WSResult->Fare->BaseFare and Status->StatusCode using foreach loop Kindly help me....
But i have multiple WsResult like [0], [1] and goes on. This is my Response from my Api.
$h=array();
$h= (array)$cliente->__call('Search',$opta);
Below is output which i got from api
Array (
[SearchResult] => stdClass Object (
[Status] => stdClass Object (
[StatusCode] => 02
[Description] => Successfull
[Category] => SR
)
[Result] => stdClass Object (
[WSResult] => Array (
[0] => stdClass Object (
[TripIndicator] => 1
[Fare] => stdClass Object (
[BaseFare] => 2539
[Tax] => 460
[ServiceTax] => 0
[AdditionalTxnFee] => 152.34
[AgentCommission] => 38.08
[TdsOnCommission] => 7.62
[IncentiveEarned] => 0.00
[TdsOnIncentive] => 0.00
[PLBEarned] => 0.00
[TdsOnPLB] => 0.00
[PublishedPrice] => 3156.34
[AirTransFee] => 0
[Currency] => INR
[Discount] => 0
[ChargeBU] => stdClass Object (
[ChargeBreakUp] => Array (
[0] => stdClass Object (
[PriceId] => 0
[ChargeType] => TboMarkup
[Amount] => 5
)
[1] => stdClass Object (
[PriceId] => 0
[ChargeType] => OtherCharges
[Amount] => 0.00
)
)
)
[OtherCharges] => 5.00
[FuelSurcharge] => 0
[TransactionFee] => 0
[ReverseHandlingCharge] => 0
[OfferedFare] => 2965.92
[AgentServiceCharge] => 0
[AgentConvienceCharges] => 0
)
)
)
)
)
)
How do I get to the BaseFare under Fare and also StatusCode under Status
I tried something like this but didn't work:
foreach($h->SearchResult as $result){
echo $result->Status->StatusCode;
echo $result->Result->WSResult->Fare->BaseFare;
}
But Im getting error as "Trying to get property of non-object".