IP Authentication will no longer be supported and is not the preferred authentication method. See the API Authentication guide for our shared secret-based method. Please contact your EAN representative or support@ean.com with any further questions.

PHP Connection Test Script

To resolve Authentication Errors from erroneous IP Authentication, try using the script below.

  • It will return the IP address that we're reading from your request.
  • Enter the reported IP address in your Developer Hub Account from the exception in the application IP field for the key and/or CID that's being used on your account.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>EAN TestScript</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<?PHP
/****************************************************
****************************************************
** Initialisation 
****************************************************
****************************************************/

$APIkey = "{your own API key}";

$cid = "{your own CID}";

/****************************************************
****************************************************
** Initialisation END
** Do not alter any code below this line
**
** EAN Script by CHeiler 05/2012
**
** Revisions:
** 2012/05/14 - First Script
****************************************************
****************************************************/
/*this url for connection testing and booking requests only*/
$url="http://book.api.ean.com/ean-services/rs/hotel/v3/list";
$url .= "?cid=$cid"; 
$url .= "&apiKey=$APIkey";
$url .= "&minorRev=4&type=xml&locale=en_US&currencyCode=EUR";

//adding XML to the request
$XML = "&xml=<HotelListRequest><city>Paris</city><currencyCode>EUR</currencyCode><arrivalDate>09/17/2012</arrivalDate><departureDate>09/18/2012</departureDate><supplierType>E</supplierType><RoomGroup><Room><numberOfAdults>1</numberOfAdults><numberOfChildren>0</numberOfChildren></Room></RoomGroup><numberOfResults>5</numberOfResults><locale>en_US</locale><sort>PRICE</sort></HotelListRequest>";

/*************************************************
* Sending Request to API
************************************************/

$header[] = "Accept: application/xml";
$ch = curl_init();
curl_setopt( $ch, CURLOPT_HTTPHEADER, $header );
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch,CURLOPT_POST,5);
curl_setopt($ch,CURLOPT_POSTFIELDS,$XML);
curl_setopt( $ch, CURLOPT_URL, $url.$XML );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$response = curl_exec($ch);
$response = simplexml_load_string($response);

/*************************************************
* Creating output
************************************************/ 
?> 

 <div id="header">
<h1>EAN API Test script</h1>
<p>This script will query the API and return a XML simple Object - in case of a rejected IP address it will provide the rejected address.</p>
</div>
<div id="request">
<h2>Request send:</h2>
<?php print_r (htmlentities($url)); ?>
</div>
<div id="respnse">

<h2>API Response:</h2>
<pre>
<?php print_r ($response); ?>
</pre>
</div> 
</body>
</html>