Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Initiate curl
- $ch = curl_init();
- // Curl setup w/ url
- curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => "https://websiteuser3.apache.techcollege.dk/api/city/get_city_list_by_country_id/" . $_POST['destination']]);
- // Execute
- $result=curl_exec($ch);
- // Closing
- $data = json_decode($result, true);
- foreach($data as $cityData) {
- // Curl setup w/ url
- curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => "https://websiteuser3.apache.techcollege.dk/api/hotel/get_hotel_list_by_city_id/" . $cityData['id']]);
- // Execute
- $result=curl_exec($ch);
- $cityData = json_decode($result, true);
- foreach($cityData as $cityRows) {
- curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => "https://websiteuser3.apache.techcollege.dk/api/room/get_room_list_by_hotel_id/" . $cityRows['id']]);
- $result=curl_exec($ch);
- $hotelData = json_decode($result, true);
- foreach($hotelData as $hotelRows) {
- if($hotelRows['num_persons'] == $_POST['amount']) {
- curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => "https://websiteuser3.apache.techcollege.dk/api/room/get_room_by_id/" . $hotelRows['room_id']]);
- $result=curl_exec($ch);
- $roomData = json_decode($result, true);
- echo '<figure>' .
- '<img src="' . $roomData['images'][0]['absolute_filename'] . '">' .
- '<h3>' . $hotelRows['room_title'] . '</h3>' .
- '<p>' . $hotelRows['hotel_title'] . '</p>';
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement