Made the API response to Tripadvisor

$this->load->library(‘gapitripadvisor/gapitripadvisor’);
$endpoint = ‘api/tripadvisor2/search’;
$request_params = array();
$request_params[‘city_id’] = ‘47292’;
$request_params[‘check_in’] = $check_in;
$request_params[‘check_out’] = $check_out;
$request_params[‘search_type’] = ‘city’;
$request_params[‘num_rooms’] = $room_count;
$request_params[‘guests’] = $room_pax_str;
$request_params[‘guests_count’] = $pax;
$request_params[‘base_url’] = BASE_URL;
$request_params[‘domain_id’] = !empty($domain_result->domain_id) ? $domain_result->domain_id : ”;

//echo ‘<pre>’; print_r($request_params);
$response = $this->gapitripadvisor->send_request(‘GET’, $endpoint, $request_params);

 

// headers to tell that result is JSON

header(‘Content-type: application/json’);

//echo $response;

 

$trip = json_decode($response,true);

//print_r($trip);die;

$trip_hotels = $trip[‘results’][‘hotels’];

//print_r($trip_hotels);die;

foreach($trip_hotels as $hotels)

{

//print_r($hotels);die;

$hotel[‘hotel_id’] = $hotels[‘hotel_id’];

$hotel[‘hotel_code’] = $hotels[‘hotel_code’];

$hotel[‘room_type’] = $hotels[‘room_type’];

$hotel[‘name’] = $hotels[‘name’];

$hotel[‘api’] = $hotels[‘api’];

$hotel[‘resort_fee’] = $hotels[‘resort_fee’];

 

$hotel[‘price’][‘price_per_room_per_night’] = $hotels[‘price’][‘price_per_room_per_night’];

$hotel[‘price’][‘tax_percentage’] = $hotels[‘price’][‘tax_percentage’];

$hotel[‘price’][‘sub_total’] = $hotels[‘price’][‘sub_total’];

$hotel[‘price’][‘tax_amount’] = $hotels[‘price’][‘tax_amount’];

$hotel[‘price’][‘total_price’] = $hotels[‘price’][‘total_price’];

$hotel[‘price’][‘currency_code’] = $hotels[‘price’][‘currency_code’];

 

$hotel[‘language’] = $hotels[‘language’];

$hotel[‘url’] = $hotels[‘url’];

$hotel_response = $hotel;

//}

//echo “=====>”.print_r($hotel_response);die;

$trip_result = [

“api_version”=> 8,

“language”=> “en_US”,

“availability_request”=> [

“api_version”=> 8,

“start_date”=> “2017-05-01”,

“end_date”=> “2017-05-03”,

“party”=> [[

“adults”=> 3

],

[

“adults”=> 2,

“children”=> [

9,

5

]

]],

“language”=> “en_US”,

“query_key”=> “6167a22d1f87d2028bf60a8e5e27afa7_191_1360299600000_2_2”,

“currency”=> “USD”,

“user_country”=> “US”,

“device_type”=> “Desktop”,

“availability_id”=> “a2fd740a-ad02-476d-b314-925a125509be”,

“requested_payload”=> [

“categories”=> [

“room_type_details”=> false,

“rate_plan_details”=> false,

“room_rate_details”=> false,

“hotel_details”=> false

],

“category_modifiers”=> [

“partner_booking_data”=> false,

“real_time_pricing”=> false,

“multiple_room_rates”=> false,

“photos”=> false,

“text”=> false

]

],

“hotels”=> [

[

“ta_hotel_id”=> $hotel_response[‘hotel_id’],

“partner_hotel_code”=> $hotel_response[‘hotel_code’]

],

]],

“response_payload”=> [

“categories”=> [

“room_type_details”=> false,

“rate_plan_details”=> false,

“room_rate_details”=> false,

“hotel_details”=> false

],

“category_modifiers”=> [

“partner_booking_data”=> false,

“real_time_pricing”=> false,

“multiple_room_rates”=> false,

“photos”=> false,

“text”=> false

]

],

 

 

“hotels”=> [

“A123″=> [

“response_type”=> “available”,

“available”=> [

“room_types”=> [

“1”=> [

“persistent_room_type_code”=> $hotel_response[‘room_type’]

],

],

“rate_plans”=> [

“1”=> [

“persistent_rate_plan_code”=> “BR21”

],

“2”=> [

“persistent_rate_plan_code”=> “OL44”

]

],

“room_rates”=> [

“1”=> [

“persistent_room_rate_code”=> “21dr-wi4g-aaa9-kg2np”,

“room_type_key”=> “1”,

“rate_plan_key”=> “1”,

“url”=> $hotel_response[‘url’],

“line_items”=> [

[

“price”=> [

“requested_currency_price”=> [

“amount”=> $hotel_response[‘price’][‘total_price’],

“currency”=> $hotel_response[‘price’][‘currency_code’]

]

],

“type”=> $hotel_response[‘price’][‘sub_total’],

“paid_at_checkout”=> false,

], [

“price”=> [

“requested_currency_price”=> [

“amount”=> $hotel_response[‘price’][‘price_per_room_per_night’],

“currency”=> $hotel_response[‘price’][‘currency_code’]

]

],

“type”=> $hotel_response[‘price’][‘tax_amount’],

“sub_type”=> $hotel_response[‘price’][‘tax_percentage’],

“paid_at_checkout”=> false,

]

]

],

]

]

],

“B456″=> [

“response_type”=> “unavailable”

],

“555”=> [

“response_type”=> “error”,

“error”=> [

“error_code”=> 3,

“message”=> “Unknown hotel id was requested.”

]

]

]

 

 

];

echo json_encode($trip_result);

Advertisements

Apache Web Server – Virtual host creation

Hosting the Zend Framework based application in the production environment is very simple and straight-forward. Just create a VirtualHost in the Apache configuration file and point the DocumentRoot to the Public folder of the Zend Framework application.

********C:\Windows\System32\drivers\etc\hosts

Eg :

127.0.0.1 localhost
127.0.0.1 1degreeadmin.vivid
127.0.0.1 1dwgapi.vivid
127.0.0.1 tourbeaver.vivid
127.0.0.1 dctoursus.vivid
127.0.0.1 venus.vivid

108.171.165.58 tourbeaver.com
108.171.165.58 http://www.tourbeaver.com

********D:\xampp\apache\conf\extra\httpd-vhosts

<VirtualHost *:80>
DocumentRoot “D:/xampp/htdocs/”
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
DocumentRoot “D:/xampp/htdocs/1degreeadmin”
ServerName 1degreeadmin.vivid
</VirtualHost>
<VirtualHost *:80>
DocumentRoot “D:/xampp/htdocs/1dwgapi_dev”
ServerName 1dwgapi.vivid
</VirtualHost>

<VirtualHost *:80>
DocumentRoot “D:/xampp/htdocs/tourbeaver_dev”
ServerName tourbeaver.vivid
</VirtualHost>
<VirtualHost *:80>
DocumentRoot “D:/xampp/htdocs/dctoursus.1degreeworld.biz”
ServerName dctoursus.vivid
</VirtualHost>
<VirtualHost *:80>
DocumentRoot “D:/xampp/htdocs/venus_dev”
ServerName venus.vivid
</VirtualHost>

 

A sample configuration (myapp) is given below −

<VirtualHost *:80> 
   ServerName myapp.localhost 
   DocumentRoot /path/to/install/myapp/public 
   <Directory /path/to/install/myapp/public> 
      DirectoryIndex index.php 
      AllowOverride All 
      Order allow,deny 
      Allow from all 
      <IfModule mod_authz_core.c> 
         Require all granted 
      </IfModule> 
   </Directory> 
</VirtualHost>

PUTTY Comments for Solr Server :

login as: root
root@104.130.100.166’s password:
Last login: Wed Apr 4 08:18:18 2018 from 49.207.183.144
[root@staging ~]# cd /opt/solr/server/solr
[root@staging solr]# vim data-config.xml
[root@staging solr]# cd viator_tours_cities
[root@staging viator_tours_cities]# ls
conf core.properties data
[root@staging viator_tours_cities]# cd conf
[root@staging conf]# ls
currency.xml elevate.xml params.json solrconfig.xml
data-config.xml lang protwords.txt stopwords.txt
dataimport.properties managed-schema schema.xml synonyms.txt
[root@staging conf]# vim data-config.xml
[root@staging conf]# server solr restart
-bash: server: command not found
[root@staging conf]# service solr restart
Sending stop command to Solr running on port 8081 … waiting 5 seconds to allow Jetty process 14884 to stop gracefully.
Waiting up to 30 seconds to see Solr running on port 8081 [/]
Started Solr server on port 8081 (pid=28250). Happy searching!

Composer installation on windows

Install Composer on Windows with XAMPP

Install Xampp

First of all, you need to download and Installed XAMPP, then we need to install Composer.

Composer

Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries according your project requirement and it will manage (install/update) them in your project for you.

Install Composer

Before start installation, Open php.ini file, you can find this file in the C:\xampp\php path.

php ini

Make sure these lines are enable by removing the semicolon (;) from the start.

extension=php_openssl.dll,
extension=php_curl.dll

Restart your xampp, extension should be enabled after that. Now we are ready to install Composer set up.

1) First Download Composer for Windows and after finished downloading click Composer-Setup.exe – it will install the latest composer version whenever it is executed. Click on the next button.

composer-first-step

2) Select php.exe file. Click on the next button.

composer-second-step

3) No need to add proxy URL. Click on the next button.

composer-third-step

4) Ready to install and click on the Install button.

composer-fourth-step

5) Once you successfully installed the Composer

Open Command Prompt from Run, press the “Win + R” key to open RUN dialog box. Type cmd, and click/tap on OK.

open command

then type composer and press enter in the terminal you will get following response like in the below image.

composer-terminal

thanks – https://www.thecodedeveloper.com/install-composer-windows-xampp/