code

<?php

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

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

// Parameters
$airline_code = "LH"; // Leave Blank for all airlines

$context = stream_context_create ( array (
		'http' => array (
				'header' => array (
						'Accept: application/xml',
						'Authorization:Bearer ' . $BEARER_TOKEN 
				) 
		) 
) );

$url = $host . 'v1/references/airlines/' . $airline_code;

try {
	$response_plain = file_get_contents ( $url, false, $context );
	$response = new SimpleXMLElement ( $response_plain );
} catch ( Exception $e ) {
	var_dump ( $e->getMessage () );
}

?>
<div class="container">

	<h1>Airline Information</h1>

	<p>&nbsp;</p>

	<div class="table-responsive">
		<table class="table table-striped">
			<thead>
				<tr>
					<th>OtherID</th>
					<th>AirlineID</th>
					<th>AirlineID_ICAO</th>
					<th>Name</th>
				</tr>
			</thead>
			<tbody>

				<?php
				foreach ( $response->Airlines [0]->Airline as $airline ) {
					?>

					<tr>
					<td><?= $airline->OtherIDs->OtherID ?></td>
					<td><?= $airline->AirlineID ?></td>
					<td><?= $airline->AirlineID_ICAO ?></td>
					<td><?= $airline->Names->Name?></td>
				</tr>

				<?php
				}
				?>
			</tbody>
		</table>
	</div>

	<pre class="pre-scrollable">
		<?= htmlentities($response_plain)?>
	</pre>

</div>
Offers Operations Reference Data oAuth