0

Hi friends. Below is an stdClass. I'm trying to parse the response, however it isn't working. I'm trying to access the object using $od[0]->FlightSegment->ArrivalAirportCode seems not working.

stdClass Object
(
    [FlightSegment] => Array
        (
            [0] => stdClass Object
                (
                    [AirEquipType] => stdClass Object
                        (
                        )

                    [ArrivalAirportCode] => BOM
                    [ArrivalDateTime] => 2014-01-03T07:15:00
                    [DepartureAirportCode] => BLR
                    [DepartureDateTime] => 2014-01-03T05:45:00
                    [FlightNumber] => 322
                    [OperatingAirlineCode] => G8
                    [OperatingAirlineFlightNumber] => 322
                    [RPH] => stdClass Object
                        (
                        )

                    [StopQuantity] => 0
                    [airLineName] => GoAir
                    [airportTax] => 5136
                    [imageFileName] => http://live.arzoo.com/FlightWS/image/goair.gif
                    [viaFlight] => stdClass Object
                        (
                        )

                    [BookingClass] => stdClass Object
                        (
                            [Availability] => 1
                            [ResBookDesigCode] => R
                        )

                    [BookingClassFare] => stdClass Object
                        (
                            [adultFare] => 6100
                            [bookingclass] => R
                            [classType] => Economy
                            [farebasiscode] => x21RoTBkeV+cJeZY1rthLBbbjLwRoy6/oicf965tvXvjBVjANsWaFZWj53ainYSrB6LTu/WMZsBq
yV/P+wwX0/qcF2MJv3QC
                            [Rule] => This fare is Refundable |Booking Class : R|Cancellation Penalty:INR 1500/- per person per sector.|Date Change Penalty: In addition to the airlines date change penalty, we charge a service fee of Rs. 250 per passenger w.e.f 16th December 2013.|All fees are subject to change without notice.
                            [adultCommission] => 0
                            [childCommission] => 0
                            [commissionOnTCharge] => 0
                        )

                    [Discount] => 439
                    [airportTaxChild] => 0
                    [airportTaxInfant] => 0
                    [adultTaxBreakup] => 3650,225,1261
                    [childTaxBreakup] => 0,0,0
                    [infantTaxBreakup] => 0,0,0
                    [octax] => 10
                )

            [1] => stdClass Object
                (
                    [AirEquipType] => stdClass Object
                        (
                        )

                    [ArrivalAirportCode] => DEL
                    [ArrivalDateTime] => 2014-01-03T09:45:00
                    [DepartureAirportCode] => BOM
                    [DepartureDateTime] => 2014-01-03T07:35:00
                    [FlightNumber] => 327
                    [OperatingAirlineCode] => G8
                    [OperatingAirlineFlightNumber] => 327
                    [RPH] => stdClass Object
                        (
                        )

                    [StopQuantity] => 0
                    [airLineName] => GoAir
                    [airportTax] => 0
                    [imageFileName] => http://live.arzoo.com/FlightWS/image/goair.gif
                    [viaFlight] => stdClass Object
                        (
                        )

                    [BookingClass] => stdClass Object
                        (
                            [Availability] => 1
                            [ResBookDesigCode] => R
                        )

                    [BookingClassFare] => stdClass Object
                        (
                            [adultFare] => 1
                            [bookingclass] => R
                            [classType] => Economy
                            [farebasiscode] => x21RoTBkeV+cJeZY1rthLBbbjLwRoy6/oicf965tvXvjBVjANsWaFZWj53ainYSrRuiQx8hec5ML
Wf6yMF787w==
                            [Rule] => This fare is Refundable |Booking Class : R|Cancellation Penalty:INR 1500/- per person per sector.|Date Change Penalty: In addition to the airlines date change penalty, we charge a service fee of Rs. 250 per passenger w.e.f 16th December 2013.|All fees are subject to change without notice.
                            [adultCommission] => 0
                            [childCommission] => 0
                            [commissionOnTCharge] => 0
                        )

                    [Discount] => 0
                    [airportTaxChild] => 0
                    [airportTaxInfant] => 0
                    [adultTaxBreakup] => 0,0,0
                    [childTaxBreakup] => 0,0,0
                    [infantTaxBreakup] => 0,0,0
                    [octax] => 10
                )

        )

)

I'm gonna loose my mind over it.

Can any one tell me what's going on please ?

1
  • Please reduce that large piece of code to the relevant part. Commented Dec 29, 2013 at 11:06

1 Answer 1

4

You need to use $od->FlightSegment[0]->ArrivalAirportCode

Sign up to request clarification or add additional context in comments.

2 Comments

Or [1], and more if there are additional elements in the array.
or [] to print all of keys/values in the array

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.