set_inserts(array('PRODUCTSMENU' => 'productsMenu', 'DTD' => 'strictdtd', 'MAINMENU' => 'mainMenu')); $translations = new LG_Translations_Database($page, $db, 'translations_view', 'id', 'groupid', 'languagecode', 'languagelocal', 'countrycode', 'countrytranslationid', 'text', 'EN', 'GB', 'Hostels'); $pdo = get_pdo(); $user = get_user($page, $pdo); $user->login();# force sending of the cookies here so it doesn't try to send them when it's too late (incurring a warning) require_once('nusoap/nusoap.php'); #$soapClient = new nusoap_client('http://www.HostelBookers.com/api/remote/hbcontent.cfc?wsdl'); $soapClient = new nusoap_client('http://v1.hb-api.com/api/remote/hbcontent.cfc?wsdl'); $hostelBookersKey = '109917018'; if ('HostelWorld' == $affiliate) { $hostel_handle = $db->prepare('SELECT * FROM hostels WHERE propertyNumber = '.$propertyNumber.' AND affiliate = \'HostelWorld\'')->execute(); if ($property = mysqli_fetch_array($hostel_handle)) { # Use these later $location[country] = $property[country]; $location[province] = $property[province]; $location[town] = $property[town]; $location[latitude] = $property[latitude]; $location[longitude] = $property[longitude]; # If it's in the database $property[city] = $property[town]; $hostel_images_handle = $db->prepare('SELECT * FROM hostelimages WHERE propertyNumber = '.$propertyNumber)->execute(); $i = 0; while ($image = mysqli_fetch_array($hostel_images_handle)) { $property[PropertyImages][PropertyImage][$i][imageURL] = $image[imageURL]; $property[PropertyImages][PropertyImage][$i][imageWidth] = 45; $property[PropertyImages][PropertyImage][$i][imageHeight] = 45; $property[PropertyImages][PropertyImage][$i][imageType] = 'Thumbnail'; $i++; } $hostel_facilities_handle = $db->prepare('SELECT * FROM hostelfacilities WHERE propertyNumber = '.$propertyNumber)->execute(); $i = 0; while ($facility = mysqli_fetch_array($hostel_facilities_handle)) { $property[Facilities][facility][$i++] = $facility[facility]; } } else { # Else, get it dynamically $get = file_get_contents("http://reservations.bookhostels.com/xmlapi/PropertyInformation.php?PropertyNumber=$propertyNumber&UserID=interhike"); $get = str_replace('&', '&', $get); $XMLDoc = XML_unserialize($get); $property = $XMLDoc[PropertyInformation][Property]; } } else if ('HostelBookers' == $affiliate) { $hostel_handle = $db->prepare('SELECT * FROM hostels WHERE propertyNumber = '.$propertyNumber.' AND affiliate = \'HostelBookers\'')->execute(); if ($property = mysqli_fetch_array($hostel_handle)) { # Use these later $location[country] = $property[country]; $location[province] = $property[province]; $location[town] = $property[town]; $location[latitude] = $property[latitude]; $location[longitude] = $property[longitude]; # If it's in the database $property[city] = $property[town]; $hostel_images_handle = $db->prepare('SELECT * FROM hostelimages WHERE propertyNumber = '.$propertyNumber)->execute(); $i = 0; while ($image = mysqli_fetch_array($hostel_images_handle)) { $property[PropertyImages][PropertyImage][$i][imageURL] = $image[imageURL]; $property[PropertyImages][PropertyImage][$i][imageWidth] = 45; $property[PropertyImages][PropertyImage][$i][imageHeight] = 45; $property[PropertyImages][PropertyImage][$i][imageType] = 'Thumbnail'; $i++; } $hostel_facilities_handle = $db->prepare('SELECT * FROM hostelfacilities WHERE propertyNumber = '.$propertyNumber)->execute(); $i = 0; while ($facility = mysqli_fetch_array($hostel_facilities_handle)) { $property[Facilities][facility][$i++] = $facility[facility]; } } else { # Else, get it dynamically $hostel = $soapClient->call('getPropertyDataByID', array('KEY' => $hostelBookersKey, 'LANGUAGE' => 'en', 'PROPERTY' => $propertyNumber)); # Fake the HostelWorld data format $property[propertyName] = $hostel[RESPONSE][NAME]; $property[address1] = $hostel[RESPONSE][ADDRESS][STREET1]; $property[address2] = $hostel[RESPONSE][ADDRESS][STREET2]; $property[city] = $hostel[RESPONSE][ADDRESS][CITY]; $property[country] = $hostel[RESPONSE][ADDRESS][COUNTRY]; $property[description] = $hostel[RESPONSE][LONGDESCRIPTION]; $property[directions] = $hostel[RESPONSE][DIRECTIONS]; $i = 0; foreach ($hostel[RESPONSE][FEATURES] as $feature) { $property[Facilities][facility][$i++] = $feature; } $i = 0; foreach ($hostel[RESPONSE][IMAGES] as $image) { $property[PropertyImages][PropertyImage][$i][imageURL] = $image; $property[PropertyImages][PropertyImage][$i][imageWidth] = 45; $property[PropertyImages][PropertyImage][$i][imageHeight] = 45; $property[PropertyImages][PropertyImage][$i][imageType] = 'Thumbnail'; $i++; } } } $page->set_title("Book hostel rooms at $property[propertyName], $property[city] - Interhike"); $page->set_description("Online hostel booking at $property[propertyName], $property[city]. Make your reservation online and only pay a 10% deposit."); $page->set_keywords("book hostels, $property[propertyName], $property[city], reservations, hostel booking, hostel reservations"); $canonical = '/'.textToUrlPath($location[country]).'/'.textToUrlPath($location[province]).'/'.textToUrlPath($location[town]).'/h'.$propertyNumber.'-'.$affiliate.'-'.textToUrlPath($property[propertyName]).'.html'; $page->set_head(($location[latitude] ? '' : '').' '); $page->print_header(); $townlower = textToUrlPath($location[town]); $provincelower = textToUrlPath($location[province]); $countrylower = textToUrlPath($location[country]); $encodedTown = htmlentities($location[town], ENT_NOQUOTES, 'UTF-8'); $encodedTown = str_replace("'", ''',$encodedTown); $encodedProvince = htmlentities($location[province], ENT_NOQUOTES, 'UTF-8'); $encodedProvince = str_replace("'", ''',$encodedProvince); $translatedCountry = $translations->get($location[country]); echo '
'.$translations->get('Hostels').' > '.$translatedCountry.' > '.$encodedProvince.' > '.$encodedTown.' > '.$property[propertyName].'
This page gives a description of your selected hostel. You can make a hostel reservation from this page by choosing your preferred room type from the pull down menu (below right) and then selecting the number of guests in your group and hitting 'Book'. If no places are available, simply click the 'Back' button on your browser to come back to this page then click it again to go back and choose a different hostel in this region.
Get Interhike Widgets for your website
$property[propertyName]$property[address1]$property[address2] $property[city] $property[country] | ";
if ($startDate and $numNights) {
if ('HostelWorld' == $affiliate) {
$get = file_get_contents("http://reservations.bookhostels.com/xmlapi/PropertyBookingInformation.php?PropertyNumber=$propertyNumber&DateStart=$startDate&NumNights=$numNights&UserID=interhike");
$get = str_replace('&', '&', $get);
$XMLDoc = XML_unserialize($get);
if ('No Beds Found' == $XMLDoc[SystemMessage][UserMessage][message]) {
echo ' '.$XMLDoc[SystemMessage][UserMessage][detail].' '; } else { echo ''; } } else if ('HostelBookers' == $affiliate) { $months = array( '01' => 'January', '02' => 'February', '03' => 'March', '04' => 'April', '05' => 'May', '06' => 'June', '07' => 'July', '08' => 'August', '09' => 'September', '10' => 'October', '11' => 'November', '12' => 'December' ); $hostel_availability = $soapClient->call('getPropertyAvailability', array('KEY' => $hostelBookersKey, 'LANGUAGE' => 'en', 'PROPERTY' => $propertyNumber, 'DATE' => "$start3-$months[$start2]-$start1", 'DAYS' => $numNights)); if ('' == $hostel_availability[RESPONSE][0][ID]) { echo 'No beds found for the time period selected '; } else { echo ''; } # echo ' |