code

<?php

// Constants
$country = 'US';

// The Client Secret
$client_secret = 'seHZnnDbQV';

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


// Getting the Token
$ch = curl_init ( 'https://api.lufthansa.com/v1/oauth/token' );
$postFields = "client_id=" . $client_id . "&client_secret=" . $client_secret . "&grant_type=client_credentials";

curl_setopt_array ( $ch, array (
		CURLOPT_POST => TRUE,
		CURLOPT_RETURNTRANSFER => TRUE,
		CURLOPT_HTTPHEADER => array (
				'Content-Type: application/x-www-form-urlencoded',
				'Host: api.lufthansa.com' 
		),
		CURLOPT_POSTFIELDS => $postFields 
) );

// Send the request
$response = curl_exec ( $ch );
if (! $response) {
	trigger_error ( curl_error ( $ch ) );
}
curl_close ( $ch );

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

// Getting the Token.
$token = $array->access_token;

?>

<!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
		$ch = curl_init ();
		curl_setopt ( $ch, CURLOPT_CUSTOMREQUEST, 'GET' );
		curl_setopt ( $ch, CURLOPT_URL, "https://api.lufthansa.com/v1/references/countries/" . $country );
		curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
		curl_setopt ( $ch, CURLOPT_HTTPHEADER, array (
				'Host: api.lufthansa.com',
				'Accept: application/xml',
				'Authorization: Bearer ' . $token 
		) );
		$response_plain = curl_exec ( $ch );
		if (! $response_plain) {
			trigger_error ( curl_error ( $ch ) );
		}
		$response = new SimpleXMLElement ( $response_plain );
		curl_close ( $ch );
		?>

		<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