-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtripdetail.php
More file actions
189 lines (130 loc) · 4.72 KB
/
tripdetail.php
File metadata and controls
189 lines (130 loc) · 4.72 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?php
include_once("server.php");
include_once("functions.php");
if(isset($_GET['id']))
{
$id = $_GET['id']+1;
}
$sql = "SELECT *FROM trips
WHERE id = $id";
$result = mysql_query($sql);
while($data = mysql_fetch_object($result)){
$trip[] = array( 'place_xc' => $data->pace_xc,
'place_y' => $data->pace_y,
'place_air' => $data->place_air,
'place_name'=> $data->place_name,
'place_expn' => $data->place_expense,
'place_photo' => $data->photo,
'smile'=> $data->smile
);
}
$lat = $trip['0']['place_xc'];
$lng = $trip['0']['place_y'];
$postdata = array(
'request' => array(
'passengers' => array(
'adultCount' => 1),
'slice'=> array(
'0' => array(
'origin' => 'BLR',
'destination' =>$trip['0']['place_air'] ,
'date' => '2016-03-01')
)
)
);
// Setup cURL
$ch = curl_init('https://www.googleapis.com/qpxExpress/v1/trips/search?key=AIzaSyAvHdLqVJday8_qQiWMl-9-4hvuztjAhOw
');
curl_setopt_array($ch, array(
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
CURLOPT_POSTFIELDS => json_encode($postdata)
));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// Send the request
$response = curl_exec($ch);
// Check for errors
if($response === FALSE){
die(curl_error($ch));
}
//
//Decode the response
$responseData = json_decode($response, TRUE);
// Print the date from the response
//$data = file_get_contents("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=".$lat.",".$lng."&radius=500&types=cafe&key=AIzaSyAvHdLqVJday8_qQiWMl-9-4hvuztjAhOw");
//echo $data;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/>
<title>Parallax Template - Materialize</title>
<!-- CSS -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/>
<link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/>
</head>
<body>
<div id="index-banner" class="parallax-container">
<div class="section no-pad-bot">
<div class="container">
<br><br>
<h1 class="header center teal-text text-lighten-2"><?php echo "#";echo$trip['0']['place_name'];?></h1>
<div class="row center">
<h5 class="header col s12 light">City to Visit</h5>
</div>
<div class="row center">
</div>
<br><br>
</div>
</div>
<div class="parallax"><img src=<?php echo$trip['0']['place_photo'] ;?> alt="Unsplashed background img 1"></div>
</div>
<div class="container">
<div class="section">
<!-- Icon Section -->
<div class="row">
<div class="col s12 m4">
<div class="icon-block">
<h2 class="center brown-text"><i class="material-icons">flash_on</i></h2>
<h5 class="center">Estimated flight cost</h5>
<p class="light"><?php echo $responseData['trips']['tripOption']['0']['pricing']['0']['saleTotal'];?><br>It is an estimated one way cost </p>
</div>
</div>
<div class="col s12 m4">
<div class="icon-block">
<h2 class="center brown-text"><i class="material-icons">group</i></h2>
<h5 class="center">Per day average expenditure</h5>
<p class="light"><?php echo $trip['0']['place_expn'];?><br> This is the per person average expense of a single day.</p>
</div>
</div>
<div class="col s12 m4">
<div class="icon-block">
<h2 class="center brown-text"><i class="material-icons">settings</i></h2>
<h5 class="center">Total expenditure</h5>
<p class="light"><?php echo (int)$trip['0']['place_expn']+(int)$responseData['trips']['tripOption']['0']['pricing']['0']['saleTotal'];?></p>
</div>
</div>
</div>
</div>
</div>
<div class="parallax-container valign-wrapper">
<div class="section no-pad-bot">
<div class="container">
<div class="row center">
<h5 class="header col s12 light">Kite data says, at this place <?php echo$trip['0']['smile'];?> is average rate of hapiness</a></h5>
</div>
</div>
</div>
<div class="parallax"><img src=<?php echo$trip['0']['place_photo'] ;?> alt="Unsplashed background img 3"></div>
</div>
<!-- Scripts-->
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="js/materialize.js"></script>
<script src="js/init.js"></script>
</body>
</html>