code

<?php

	//The client Sectet
	$client_secret = 'seHZnnDbQV';

	//The Client ID
	$client_id = 'rrar5ahvmu2rcmxyqzzuppnf';

	//The Country to search for
	$country = 'US';

	//Getting the token
	$context = stream_context_create(array('http' => array(
				'method' => 'POST',
				'header' =>
				'Content-Type: application/x-www-form-urlencoded',
				'Host: api.lufthansa.com',
				'content' => "client_secret=".$client_secret.'&grant_type=client_credentials&client_id='.$client_id
			)));
	$url = 'https://api.lufthansa.com/v1/oauth/token';

	try {
		$response_plain = file_get_contents($url, false, $context);

		//Decode the response
		$array = json_decode($response_plain);

		//Storing the token
		$token = $array -> access_token;

	} catch (Exception $e) {
		var_dump($e->getMessage());
	}
?>



<!DOCTYPE html>

<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Get information about countries</title>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
</head>

<body>
	<div class="container">
		<h1>Countries</h1>

<!-- 		GET-Request for chosen Country. -->
		<?php
			$options = (array('http' => array(
			'header' =>
			'Authorization: Bearer ' . $token . "\r\n" .
			'Accept: application/xml'
			)));

			$context = stream_context_create($options);
			$url = 'https://api.lufthansa.com/v1/references/countries/' . $country;

			try {
				$response_plain = file_get_contents($url, false, $context);
				$response = new SimpleXMLElement($response_plain);

			} catch (Exception $e) {
				var_dump($e->getMessage());
			}
		?>

		<p>&nbsp;</p>

		<h2>The Country Code: <?php echo($response->Countries->Country->CountryCode) ?></h2>
		<h2>The Zone Code: <?php echo($response->Countries->Country->ZoneCode) ?></h2>

		<div class="table-responsive">
			<table class="table table-striped">
				<thead>
					<tr>
						<th>Language-Code</th>
						<th>Name</th>
					</tr>
				</thead>
				<tbody>
					<?php foreach($response ->Countries->Country->Names->Name as $name) { ?>
						<tr>
							<td><? echo($name['LanguageCode'])?></td>
							<td><? echo($name)?></td>
						</tr>

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

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

	  </div>
  </body>
</html>
Offers Operations Reference Data oAuth