code

<?php

// token from oAuth call
$BEARER_TOKEN = "token from oAuth call";

// Host in the URL
$host = "https://api.lufthansa.com/";

$flight = "LH400";
$date = "2015-03-07";
$request_url = $host . 'v1/operations/flightstatus/' . $flight . '/' . $date;

try {
	$context = stream_context_create ( array (
			'http' => array (
					'header' => array (
							'Accept: application/xml',
							'Authorization:Bearer ' . $BEARER_TOKEN 
					) 
			) 
	) );
	
	$response_plain = file_get_contents ( $request_url, false, $context );
	$response = new SimpleXMLElement ( $response_plain );
} catch ( Exception $e ) {
	var_dump ( $e->getMessage () );
}
?>
<div class="container">
	<br />
	<h1>Flight Status Response</h1>

	<h2>Flights with <? echo($flight)?></h2>

	<div class="table-responsive">
		<table class="table table-striped">
			<thead>
				<tr>
					<td>Departure from</td>
					<td>Departure Time Local</td>
					<td>Terminal Departure</td>
					<td>Arrival At</td>
					<td>Arrival Time Local</td>
					<td>Terminal Arrival</td>
					<td>Marketing Airline ID</td>
					<td>Marketing Flight Number</td>
					<td>Operating AirlineID</td>
					<td>Operating Flight Number</td>
					<td>Aircraft Code</td>
					<td>FlightStatus</td>
					<td>Arrival Time Status</td>
					<td>Departure Time Status</td>
				</tr>
			</thead>
			<tbody>
				<?php
				foreach ( $response->Flights [0]->Flight as $flight ) {
					?>
				<tr>
					<td><?= $flight->Departure->AirportCode?></td>
					<td><?= $flight->Departure->ScheduledTimeLocal->DateTime?></td>
					<td><?= $flight->Departure->Terminal->Gate ?></td>
					<td><?= $flight->Arrival->AirportCode?></td>
					<td><?= $flight->Arrival->ScheduledTimeLocal->DateTime?></td>
					<td><?= $flight->Arrival->Terminal->Gate ?></td>
					<td><?= $flight->MarketingCarrier->AirlineID ?> </td>
					<td><?= $flight->MarketingCarrier->FlightNumber?></td>
					<td><?= $flight->OperatingCarrier->AirlineID ?> </td>
					<td><?= $flight->OperatingCarrier->FlightNumber?></td>
					<td><?= $flight->Equipment->AircraftCode ?> </td>
					<td><?= $flight->FlightStatus->Code ?> (<?= $flight->FlightStatus->Definition?>)</td>
					<td><?= $flight->Arrival->TimeStatus->Code ?> (<?= $flight->Arrival->TimeStatus->Definition?>)</td>
					<td><?= $flight->Departure->TimeStatus->Code ?> (<?= $flight->Departure->TimeStatus->Definition?>)</td>
				</tr>					
				<?php }	?>
			</tbody>
		</table>
	</div>
	<pre class="pre-scrollable">
		<?= htmlentities($response_plain)?>
	</pre>

</div>
Offers Operations Reference Data oAuth