code

<?php


	//token from oAuth call
	$BEARER_TOKEN = "token from oAuth call";	
	
	//Host in the URL
	$host = "https://api.lufthansa.com/";

	//Parameters
	$location = "ZRH";	//IATA airport or city code(e.g. ZRH)
	$cabinClass = "F";	//Limit to this cabin class ('F', 'C', 'E', 'M')
	$tierCode = "";		//Frequent flyer level ('HON', 'SEN', 'SGC', 'FTL')
	$lang = "en";			//Language code

	
	function showFlags($element){
		foreach ($element->children() as $flag){
			if ($flag->__toString() == 'true'){
				echo $flag->getName().'<br/>';
			}
		}
		
	}
	$context = stream_context_create ( array (
			'http' => array (
					'header' => array (
							'Accept: application/xml',
							'Authorization:Bearer ' . $BEARER_TOKEN
					)
			)
	) );
	
	$url = $host.'v1/offers/lounges/'.$location.'?cabinClass='.$cabinClass.'&tierCode='.$tierCode.'&lang='.$lang;

	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>Lounges Information</h1>

	<p>&nbsp;</p>

	<div class="table-responsive">
		<table class="table table-striped">
			<thead>
				<tr>
					<th>Name</th>
					<th>Airport</th>
					<th>City Code</th>
					<th>Location</th>
					<th>Open hours</th>
					<th>Features</th>
					<th>Magazine and News</th>
				</tr>
			</thead>
			<tbody>

				<?php
					foreach($response->Lounges[0]->Lounge as $lounge) {
				?>

					<tr>
						<td><?= $lounge->Names->Name ?></td>
						<td><?= $lounge->AirportCode?></td>
						<td><?= $lounge->CityCode ?></td>
						<td><?= $lounge->Locations->Location ?></td>
					    <td><?= $lounge->OpeningHours->OpeningHours ?></td>
					    <td><?= showFlags($lounge->Features)?></td>
					    <td><?= showFlags($lounge->MagazinesAndNews) ?></td>
					    						
					</tr>

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

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

  </div>
Offers Operations Reference Data oAuth