403Webshell
Server IP : 103.234.187.230  /  Your IP : 216.73.216.216
Web Server : Apache
System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/b2bzend/cronjob/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/b2bzend/cronjob/getHotelFromTBO.php
<?php

#require_once 'init.php';

function goRequest($url, $method, $postData) {
    $curl = curl_init();
    curl_setopt_array($curl, array(
        CURLOPT_URL => $url,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => $method,
        CURLOPT_POSTFIELDS => json_encode($postData),
        CURLOPT_HTTPHEADER => array(
            "cache-control: no-cache",
            "content-type: application/json",
        ),
    ));
    return $response = curl_exec($curl);
}

function getHotelTagging($cityId = NULL) {
    if ($cityId) {
        $datah = array(
            "ClientId" => "tboprod",
            'EndUserIp' => $_SERVER["REMOTE_ADDR"],
            'TokenId' => 'a966850f-1817-48b9-8c02-8a121e967275',
        );
        $data_stringh = json_encode($datah);
        $DestinationList = "https://api.travelboutiqueonline.com/SharedApi/StaticData.svc/rest/GetTaggingStaticData";
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $DestinationList);
        curl_setopt($ch, CURLOPT_ENCODING, "gzip");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data_stringh);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            'Content-Type: application/json',
            'Content-Length: ' . strlen($data_stringh)
        ));
        $outputH = curl_exec($ch);
        $responseTBO = json_decode($outputH, true);
        $HotelData = str_replace('encoding="utf-16"', 'encoding="utf-8"', $responseTBO['TaggingData']);
        $objXmlDocuments = simplexml_load_string($HotelData, 'SimpleXMLElement', LIBXML_NOCDATA);
        $objJsonDocument = json_encode($objXmlDocuments);
        $arrOutput = json_decode($objJsonDocument, TRUE);
        return $arrOutput;
    } else {
        return array();
    }
}

function getHotelStaticData($cityId = NULL) {
    if ($cityId) {
        $datah = array(
            "CityId" => $cityId,
            "ClientId" => "tboprod",
            'EndUserIp' => "127.0.0.1",
            'TokenId' => 'a966850f-1817-48b9-8c02-8a121e967275',
        );
        $data_stringh = json_encode($datah);
        $DestinationList = "https://api.travelboutiqueonline.com/SharedAPI/StaticData.svc/rest/GetHotelStaticData";
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $DestinationList);
        curl_setopt($ch, CURLOPT_ENCODING, "gzip");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data_stringh);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            'Content-Type: application/json',
            'Content-Length: ' . strlen($data_stringh)
        ));
        $outputH = curl_exec($ch);
        $responseTBO = json_decode($outputH, true);
        $HotelData = str_replace('encoding="utf-16"', 'encoding="utf-8"', $responseTBO['HotelData']);
        $objXmlDocuments = simplexml_load_string($HotelData, 'SimpleXMLElement', LIBXML_NOCDATA);
        $objJsonDocument = json_encode($objXmlDocuments);
        $arrOutput = json_decode($objJsonDocument, true);
        return $arrOutput;
    } else {
        return array();
    }
}

$CountryName = 101;
$postDataArray = array();
$get_method = "GET";
$CityName = "Agra";
$CountryName = "India";
$url = 'https://hotels.globaltravelexchange.com/api/v1/tbo-hotel-cities/?CityName=' . $CityName . '&CountryId=' . $CountryName;
//$url = 'https://hotels.globaltravelexchange.com/api/v1/tbo-hotel-cities/?CountryId=' . $CountryName;
$response = goRequest($url, $get_method, $postDataArray);
#echo "<pre>";print_r($response);exit;
$responseArray = json_decode($response, true);
foreach ($responseArray as $dataSetVal) {
    $TBBCityId = isset($dataSetVal['TBBCityId']) ? trim($dataSetVal['TBBCityId']) : '';
    $id = isset($dataSetVal['id']) ? $dataSetVal['id'] : '';
    if ($TBBCityId != '') {
        $getResultSet = getHotelStaticData($TBBCityId);
        $hotelArray = array();
        if (!empty(isset($getResultSet['BasicPropertyInfo'])) && !empty($getResultSet['BasicPropertyInfo'])) {
            foreach ($getResultSet['BasicPropertyInfo'] as $Hotlevalue) {
                $hotelArray = $Hotlevalue['@attributes'];
                foreach ($Hotlevalue as $keyVal => $hotelArraySet) {
                    if (isset($hotelArraySet['VendorMessage']) && !empty($hotelArraySet['VendorMessage'])) {
                        foreach ($hotelArraySet['VendorMessage'] as $hotelotherdetail) {
                            if (isset($hotelotherdetail['SubSection']) && !empty($hotelotherdetail['SubSection'])) {
                                $keyval = isset($hotelotherdetail['@attributes']['Title']) ? trim($hotelotherdetail['@attributes']['Title']) : '';
                                $j = 0;
                                if (is_array($hotelotherdetail['SubSection'])) {
                                    foreach ($hotelotherdetail['SubSection'] as $hotelattractions) {
                                        $valueOfattraction = (isset($hotelattractions['Paragraph']['Text']) && $hotelattractions['Paragraph']['Text'] != '') ? trim(@$hotelattractions['Paragraph']['Text']) : '';
                                        $valueOfattractionOnlyText = (isset($hotelattractions['Text']) && $hotelattractions['Text'] != '') ? trim(@$hotelattractions['Text']) : '';
                                        if ($valueOfattraction != '') {
                                            $hotelArray[$keyval][$j] = $valueOfattraction;
                                        }
                                        if ($valueOfattractionOnlyText != '') {
                                            $hotelArray[$keyval][$j] = $valueOfattractionOnlyText;
                                        }
                                        $j++;
                                    }
                                }
                            }
                        }
                    } else {
                        $hotelArray[$keyVal] = $hotelArraySet;
                    }
                }
                $hotelInfoArray = array(
                    'hotel_id' => isset($hotelArray['TBOHotelCode']) ? trim($hotelArray['TBOHotelCode']) : '',
                    'name' => isset($hotelArray['HotelName']) ? trim($hotelArray['HotelName']) : '',
                    "city" => isset($hotelArray['HotelCityCode']) ? trim($hotelArray['HotelCityCode']) : '',
                    "hotel_info" => json_encode($hotelArray),
                    "is_active" => false,
                    "is_mark_for_delete" => false
                );
//echo "<pre>";print_r($hotelInfoArray);exit;
                $method = "POST";
                $url = 'https://hotels.globaltravelexchange.com/api/v1/tbo-hotel-static-data/';
                $returnArray = goRequest($url, $method, $hotelInfoArray);
                //echo "<pre>";print_r($returnArray);exit;
            }
            $method = "PATCH";
            $addUrl = $id . '/';
            $postData = array(
                "is_hotel_static_data_fetched" => true,
            );
            $url = 'https://hotels.globaltravelexchange.com/api/v1/tbo-hotel-cities/' . $addUrl;
            $result = goRequest($url, $method, $postData);
        }
    }
}







Youez - 2016 - github.com/yon3zu
LinuXploit