PHP code example of hgv / mss-php
1. Go to this page and download the library: Download hgv/mss-php library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hgv / mss-php example snippets
Crutches\Bitmask;
use MssPhp\Client;
use MssPhp\Bitmask\HotelDetails;
$client = new Client([
"user" => "username",
"password" => "password",
"source" => "source",
]);
$res = $client->request(function ($req) {
$req->header->method = "getHotelList";
$req->request->search->id = ["11230"];
$req->request->options->hotel_details = (new Bitmask(
HotelDetails::BASIC_INFO | HotelDetails::COORDINATES
))->getBitmask();
});
$hotel = $res["result"]["hotel"][0];
$hotel["name"]; // => string(18) "Hotel Lichtenstern"
$hotel["stars"]; // => float(3)
$hotel["geolocation"]["latitude"]; // => float(46.53063158978)
use MssPhp\Exception;
// ...
try {
$res = $client->request(function ($req) {
// ...
});
} catch (Exception\MssException $e) {
$e->getMessage(); // => string(50) "Invalid value '2016-04-08' for parameter 'arrival'"
$e->getCode(); // => int(32)
$e->getResponse()->getStatusCode(); // => int(400)
}
bash
composer