-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
145 lines (120 loc) · 4.31 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Its a ean API test page </title>
<style type="text/css">
h1 {
text-align: center;
}
body {
//background: url('/images/IMG_7467.jpg') no-repeat;
//background-size: 100%;
}
/* search form
-------------------------------------- */
.searchform {
display: inline-block;
zoom: 1; /* ie7 hack for display:inline-block */
*display: inline;
border: solid 1px #d2d2d2;
padding: 3px 5px;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius: 2em;
-webkit-box-shadow: 0 1px 0px rgba(0,0,0,.1);
-moz-box-shadow: 0 1px 0px rgba(0,0,0,.1);
box-shadow: 0 1px 0px rgba(0,0,0,.1);
background: #f1f1f1;
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed));
background: -moz-linear-gradient(top, #fff, #ededed);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed'); /* ie7 */
-ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed'); /* ie8 */
}
.searchform input {
font: normal 12px/100% Arial, Helvetica, sans-serif;
}
.searchform .neighborhood {
background: #fff;
padding: 6px 6px 6px 8px;
width: 400px;
border: solid 1px #bcbbbb;
outline: none;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius: 2em;
-moz-box-shadow: inset 0 1px 2px rgba(0,0,0,.2);
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.2);
box-shadow: inset 0 1px 2px rgba(0,0,0,.2);
}
.searchform .searchbutton {
color: #fff;
border: solid 1px #494949;
font-size: 11px;
height: 27px;
width: 27px;
text-shadow: 0 1px 1px rgba(0,0,0,.6);
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius: 2em;
background: #5f5f5f;
background: -webkit-gradient(linear, left top, left bottom, from(#9e9e9e), to(#454545));
background: -moz-linear-gradient(top, #9e9e9e, #454545);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#9e9e9e', endColorstr='#454545'); /* ie7 */
-ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#9e9e9e', endColorstr='#454545'); /* ie8 */
}
#logo {
margin-bottom: 1em;
}
#tagline {
font-size: 54px;
font-style: italic;
// color: white;
margin-bottom: 3em;
}
</style>
</head>
<body>
<div class="container">
<div class="header"></a>
<!-- end .header --></div>
<div class="content" style="text-align:center">
<p id="tagline">EAN Test</p>
<?php
//You can find the below at http://developer.ean.com/
//Declare your key, secret key and callback URL variables (Without these, the api wont work at all)
$consumerKey = "consumer";
$clientSecret = "secretkey";
//Include the EAN class
require_once('ean.php');
//And some code!
$ean = new EAN($consumerKey, $clientSecret);
// make the page all good looking
echo '<br><span style="text-align:left;font-family: Arial, Helvetica, sans-serif; color: black; font-weight: bold; font-size: 20px;">';
echo '<pre>';
//lets find a hotel using the discover Hotel api
$discovery = json_decode($ean->discoverHotel('new york city',null,null,'10',null),1);
// want to see the entire result, print_r it
//print_r($discovery); // you may find $discovery['searchResults']['searchResult']['metadata'] interesting if you intend to paginate
$results= $discovery['searchResults']['searchResult']['0']['results']['result'];
//Great, we can now get the top 10 results (because that is the limit we set in discoverHotel above)
echo "<h1>Top 10 Results</h1>";
print_r($results);
// great, now lets show conversions between the two of them
echo "<h2>Id conversions</h2>";
foreach ($results as $hotelFound) {
echo $hotelFound['item']['itemId']['id'].'</br>';
echo $ean->ToExpedia($hotelFound['item']['itemId']['id']);
echo '<br><br>';
}
flush();
echo '</pre>';
?>
</span>
<div>
</div>
<div class="footer">
<!-- end .footer --></div>
<!-- end .container --></div>
</body>
</html>