Leaderboard
Popular Content
Showing content with the highest reputation on 01/10/2023 in all areas
-
It's been a particularly miserable , grey, rainy sort of a day so I passed some time on this <?php $json = '{"meta":{"count":5,"links":{"self":"https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=CPT&destinationLocationCode=LGW&departureDate=2023-03-01&returnDate=2023-03-08&adults=1&travelClass=ECONOMY¤cyCode=ZAR&max=5"}},"data":[{"type":"flight-offer","id":"1","source":"GDS","instantTicketingRequired":false,"nonHomogeneous":false,"oneWay":false,"lastTicketingDate":"2023-03-01","numberOfBookableSeats":7,"itineraries":[{"duration":"PT18H50M","segments":[{"departure":{"iataCode":"CPT","at":"2023-03-01T12:55:00"},"arrival":{"iataCode":"DOH","at":"2023-03-01T23:40:00"},"carrierCode":"QR","number":"1372","aircraft":{"code":"77W"},"operating":{"carrierCode":"QR"},"duration":"PT9H45M","id":"5","numberOfStops":0,"blacklistedInEU":false},{"departure":{"iataCode":"DOH","at":"2023-03-02T01:15:00"},"arrival":{"iataCode":"LGW","terminal":"S","at":"2023-03-02T05:45:00"},"carrierCode":"QR","number":"5943","aircraft":{"code":"777"},"operating":{"carrierCode":"BA"},"duration":"PT7H30M","id":"6","numberOfStops":0,"blacklistedInEU":false}]},{"duration":"PT19H10M","segments":[{"departure":{"iataCode":"LGW","terminal":"S","at":"2023-03-08T14:05:00"},"arrival":{"iataCode":"DOH","at":"2023-03-08T23:45:00"},"carrierCode":"QR","number":"5942","aircraft":{"code":"777"},"operating":{"carrierCode":"BA"},"duration":"PT6H40M","id":"7","numberOfStops":0,"blacklistedInEU":false},{"departure":{"iataCode":"DOH","at":"2023-03-09T02:15:00"},"arrival":{"iataCode":"CPT","at":"2023-03-09T11:15:00"},"carrierCode":"QR","number":"1369","aircraft":{"code":"77W"},"operating":{"carrierCode":"QR"},"duration":"PT10H","id":"8","numberOfStops":0,"blacklistedInEU":false}]}],"price":{"currency":"ZAR","total":"12632.45","base":"6370.00","fees":[{"amount":"0.00","type":"SUPPLIER"},{"amount":"0.00","type":"TICKETING"}],"grandTotal":"12632.45"},"pricingOptions":{"fareType":["PUBLISHED"],"includedCheckedBagsOnly":true},"validatingAirlineCodes":["QR"],"travelerPricings":[{"travelerId":"1","fareOption":"STANDARD","travelerType":"ADULT","price":{"currency":"ZAR","total":"12632.45","base":"6370.00"},"fareDetailsBySegment":[{"segmentId":"5","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}},{"segmentId":"6","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}},{"segmentId":"7","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}},{"segmentId":"8","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}}]}]},{"type":"flight-offer","id":"2","source":"GDS","instantTicketingRequired":false,"nonHomogeneous":false,"oneWay":false,"lastTicketingDate":"2023-03-01","numberOfBookableSeats":7,"itineraries":[{"duration":"PT19H15M","segments":[{"departure":{"iataCode":"CPT","at":"2023-03-01T19:10:00"},"arrival":{"iataCode":"DOH","at":"2023-03-02T05:55:00"},"carrierCode":"QR","number":"1370","aircraft":{"code":"77W"},"operating":{"carrierCode":"QR"},"duration":"PT9H45M","id":"1","numberOfStops":0,"blacklistedInEU":false},{"departure":{"iataCode":"DOH","at":"2023-03-02T08:05:00"},"arrival":{"iataCode":"LGW","terminal":"N","at":"2023-03-02T12:25:00"},"carrierCode":"QR","number":"327","aircraft":{"code":"788"},"operating":{"carrierCode":"QR"},"duration":"PT7H20M","id":"2","numberOfStops":0,"blacklistedInEU":false}]},{"duration":"PT19H10M","segments":[{"departure":{"iataCode":"LGW","terminal":"S","at":"2023-03-08T14:05:00"},"arrival":{"iataCode":"DOH","at":"2023-03-08T23:45:00"},"carrierCode":"QR","number":"5942","aircraft":{"code":"777"},"operating":{"carrierCode":"BA"},"duration":"PT6H40M","id":"7","numberOfStops":0,"blacklistedInEU":false},{"departure":{"iataCode":"DOH","at":"2023-03-09T02:15:00"},"arrival":{"iataCode":"CPT","at":"2023-03-09T11:15:00"},"carrierCode":"QR","number":"1369","aircraft":{"code":"77W"},"operating":{"carrierCode":"QR"},"duration":"PT10H","id":"8","numberOfStops":0,"blacklistedInEU":false}]}],"price":{"currency":"ZAR","total":"12632.45","base":"6370.00","fees":[{"amount":"0.00","type":"SUPPLIER"},{"amount":"0.00","type":"TICKETING"}],"grandTotal":"12632.45"},"pricingOptions":{"fareType":["PUBLISHED"],"includedCheckedBagsOnly":true},"validatingAirlineCodes":["QR"],"travelerPricings":[{"travelerId":"1","fareOption":"STANDARD","travelerType":"ADULT","price":{"currency":"ZAR","total":"12632.45","base":"6370.00"},"fareDetailsBySegment":[{"segmentId":"1","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}},{"segmentId":"2","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}},{"segmentId":"7","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}},{"segmentId":"8","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}}]}]},{"type":"flight-offer","id":"3","source":"GDS","instantTicketingRequired":false,"nonHomogeneous":false,"oneWay":false,"lastTicketingDate":"2023-03-01","numberOfBookableSeats":7,"itineraries":[{"duration":"PT25H30M","segments":[{"departure":{"iataCode":"CPT","at":"2023-03-01T12:55:00"},"arrival":{"iataCode":"DOH","at":"2023-03-01T23:40:00"},"carrierCode":"QR","number":"1372","aircraft":{"code":"77W"},"operating":{"carrierCode":"QR"},"duration":"PT9H45M","id":"3","numberOfStops":0,"blacklistedInEU":false},{"departure":{"iataCode":"DOH","at":"2023-03-02T08:05:00"},"arrival":{"iataCode":"LGW","terminal":"N","at":"2023-03-02T12:25:00"},"carrierCode":"QR","number":"327","aircraft":{"code":"788"},"operating":{"carrierCode":"QR"},"duration":"PT7H20M","id":"4","numberOfStops":0,"blacklistedInEU":false}]},{"duration":"PT19H10M","segments":[{"departure":{"iataCode":"LGW","terminal":"S","at":"2023-03-08T14:05:00"},"arrival":{"iataCode":"DOH","at":"2023-03-08T23:45:00"},"carrierCode":"QR","number":"5942","aircraft":{"code":"777"},"operating":{"carrierCode":"BA"},"duration":"PT6H40M","id":"7","numberOfStops":0,"blacklistedInEU":false},{"departure":{"iataCode":"DOH","at":"2023-03-09T02:15:00"},"arrival":{"iataCode":"CPT","at":"2023-03-09T11:15:00"},"carrierCode":"QR","number":"1369","aircraft":{"code":"77W"},"operating":{"carrierCode":"QR"},"duration":"PT10H","id":"8","numberOfStops":0,"blacklistedInEU":false}]}],"price":{"currency":"ZAR","total":"12632.45","base":"6370.00","fees":[{"amount":"0.00","type":"SUPPLIER"},{"amount":"0.00","type":"TICKETING"}],"grandTotal":"12632.45"},"pricingOptions":{"fareType":["PUBLISHED"],"includedCheckedBagsOnly":true},"validatingAirlineCodes":["QR"],"travelerPricings":[{"travelerId":"1","fareOption":"STANDARD","travelerType":"ADULT","price":{"currency":"ZAR","total":"12632.45","base":"6370.00"},"fareDetailsBySegment":[{"segmentId":"3","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}},{"segmentId":"4","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}},{"segmentId":"7","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}},{"segmentId":"8","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}}]}]},{"type":"flight-offer","id":"4","source":"GDS","instantTicketingRequired":false,"nonHomogeneous":false,"oneWay":false,"lastTicketingDate":"2023-03-01","numberOfBookableSeats":7,"itineraries":[{"duration":"PT18H50M","segments":[{"departure":{"iataCode":"CPT","at":"2023-03-01T12:55:00"},"arrival":{"iataCode":"DOH","at":"2023-03-01T23:40:00"},"carrierCode":"QR","number":"1372","aircraft":{"code":"77W"},"operating":{"carrierCode":"QR"},"duration":"PT9H45M","id":"5","numberOfStops":0,"blacklistedInEU":false},{"departure":{"iataCode":"DOH","at":"2023-03-02T01:15:00"},"arrival":{"iataCode":"LGW","terminal":"S","at":"2023-03-02T05:45:00"},"carrierCode":"QR","number":"5943","aircraft":{"code":"777"},"operating":{"carrierCode":"BA"},"duration":"PT7H30M","id":"6","numberOfStops":0,"blacklistedInEU":false}]},{"duration":"PT19H10M","segments":[{"departure":{"iataCode":"LGW","terminal":"N","at":"2023-03-08T14:05:00"},"arrival":{"iataCode":"DOH","at":"2023-03-08T23:50:00"},"carrierCode":"QR","number":"328","aircraft":{"code":"788"},"operating":{"carrierCode":"QR"},"duration":"PT6H45M","id":"9","numberOfStops":0,"blacklistedInEU":false},{"departure":{"iataCode":"DOH","at":"2023-03-09T02:15:00"},"arrival":{"iataCode":"CPT","at":"2023-03-09T11:15:00"},"carrierCode":"QR","number":"1369","aircraft":{"code":"77W"},"operating":{"carrierCode":"QR"},"duration":"PT10H","id":"10","numberOfStops":0,"blacklistedInEU":false}]}],"price":{"currency":"ZAR","total":"12670.45","base":"6370.00","fees":[{"amount":"0.00","type":"SUPPLIER"},{"amount":"0.00","type":"TICKETING"}],"grandTotal":"12670.45"},"pricingOptions":{"fareType":["PUBLISHED"],"includedCheckedBagsOnly":true},"validatingAirlineCodes":["QR"],"travelerPricings":[{"travelerId":"1","fareOption":"STANDARD","travelerType":"ADULT","price":{"currency":"ZAR","total":"12670.45","base":"6370.00"},"fareDetailsBySegment":[{"segmentId":"5","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}},{"segmentId":"6","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}},{"segmentId":"9","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}},{"segmentId":"10","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}}]}]},{"type":"flight-offer","id":"5","source":"GDS","instantTicketingRequired":false,"nonHomogeneous":false,"oneWay":false,"lastTicketingDate":"2023-03-01","numberOfBookableSeats":9,"itineraries":[{"duration":"PT19H15M","segments":[{"departure":{"iataCode":"CPT","at":"2023-03-01T19:10:00"},"arrival":{"iataCode":"DOH","at":"2023-03-02T05:55:00"},"carrierCode":"QR","number":"1370","aircraft":{"code":"77W"},"operating":{"carrierCode":"QR"},"duration":"PT9H45M","id":"1","numberOfStops":0,"blacklistedInEU":false},{"departure":{"iataCode":"DOH","at":"2023-03-02T08:05:00"},"arrival":{"iataCode":"LGW","terminal":"N","at":"2023-03-02T12:25:00"},"carrierCode":"QR","number":"327","aircraft":{"code":"788"},"operating":{"carrierCode":"QR"},"duration":"PT7H20M","id":"2","numberOfStops":0,"blacklistedInEU":false}]},{"duration":"PT19H10M","segments":[{"departure":{"iataCode":"LGW","terminal":"N","at":"2023-03-08T14:05:00"},"arrival":{"iataCode":"DOH","at":"2023-03-08T23:50:00"},"carrierCode":"QR","number":"328","aircraft":{"code":"788"},"operating":{"carrierCode":"QR"},"duration":"PT6H45M","id":"9","numberOfStops":0,"blacklistedInEU":false},{"departure":{"iataCode":"DOH","at":"2023-03-09T02:15:00"},"arrival":{"iataCode":"CPT","at":"2023-03-09T11:15:00"},"carrierCode":"QR","number":"1369","aircraft":{"code":"77W"},"operating":{"carrierCode":"QR"},"duration":"PT10H","id":"10","numberOfStops":0,"blacklistedInEU":false}]}],"price":{"currency":"ZAR","total":"12670.45","base":"6370.00","fees":[{"amount":"0.00","type":"SUPPLIER"},{"amount":"0.00","type":"TICKETING"}],"grandTotal":"12670.45"},"pricingOptions":{"fareType":["PUBLISHED"],"includedCheckedBagsOnly":true},"validatingAirlineCodes":["QR"],"travelerPricings":[{"travelerId":"1","fareOption":"STANDARD","travelerType":"ADULT","price":{"currency":"ZAR","total":"12670.45","base":"6370.00"},"fareDetailsBySegment":[{"segmentId":"1","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}},{"segmentId":"2","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}},{"segmentId":"9","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}},{"segmentId":"10","cabin":"ECONOMY","fareBasis":"NLR1R1RX","brandedFare":"ECLASSIC","class":"N","includedCheckedBags":{"quantity":2}}]}]}],"dictionaries":{"locations":{"CPT":{"cityCode":"CPT","countryCode":"ZA"},"DOH":{"cityCode":"DOH","countryCode":"QA"},"LGW":{"cityCode":"LON","countryCode":"GB"}},"aircraft":{"77W":"BOEING 777-300ER","777":"BOEING 777-200/300","788":"BOEING 787-8"},"currencies":{"ZAR":"S.AFRICAN RAND"},"carriers":{"QR":"QATAR AIRWAYS","BA":"BRITISH AIRWAYS"}}}'; $array = json_decode($json, true); $html = ''; foreach ($array['data'] as $offer) { $html .= buildOfferTable($offer); } function buildOfferTable($offer) { $html = "<div class='w3-row w3-padding w3-topbar'> <div class='w3-col w3-quarter'> Offer ID : {$offer['id']} </div> <div class='w3-col w3-quarter'> Source : {$offer['source']} </div> <div class='w3-col w3-half'> <b>Total Price : {$offer['price']['total']} {$offer['price']['currency']}</b> </div> </div> <table class='w3-table w3-bordered'> <tr class='w3-indigo'> <th>Segment</th> <th>Flight No</th> <th>Departure Time</th> <th>Arrival Time</th> </tr> "; foreach ($offer['itineraries']as $itins) { foreach ($itins['segments'] as $segment) { $html .= segmentRow($segment); } } $html .= "</table>\n<br>"; foreach ($offer['travelerPricings'] as $k => $tp) { $n = $k + 1; $html .= "Traveller $n : {$tp['travelerType']}<br> Amount : {$tp['price']['total']} {$tp['price']['currency']}<br><br> "; } return $html; } function segmentRow($segment) { $dt = (new DateTime($segment['departure']['at']))->format('Y-m-d H:i'); $at = (new DateTime($segment['arrival']['at']))->format('Y-m-d H:i'); $row = "<tr> <td>{$segment['departure']['iataCode']}-{$segment['arrival']['iataCode']}</td> <td>{$segment['carrierCode']} {$segment['number']}</td> <td>$dt</td> <td>$at</td> </tr> "; return $row; } ?> <!DOCTYPE=html> <html lang="en"> <head> <meta charset='utf-8'> <title>Flight Offers</title> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> </head> <body> <h1>Flight Offers</h1> <div class='w3-content'> <?= $html ?> </div> </body> </html> producing 5 offers like this ...1 point
This leaderboard is set to New York/GMT-05:00