| 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 : |
<?php
error_reporting(E_ALL);
function checkdata($checkId) {
if (!empty($checkId)) {
$DestinationList = "https://hotels.globaltravelexchange.com/api/v1/tbo-hotel-cities/?CityId=" .trim($checkId);
$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, "GET");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json'
));
try{
$outputH = curl_exec($ch);
return $outputH;
} catch(Zend_Exception $e){
echo $e->getMessage(); exit;
}
}
}
function updatedata($datah) {
if (!empty($datah)) {
$data_stringh = json_encode($datah);
$DestinationList = "https://hotels.globaltravelexchange.com/api/v1/tbo-hotel-cities/";
$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)
));
return $outputH = curl_exec($ch);
//echo "<pre>";print_r($outputH); exit;
} else {
return array();
}
}
function getTBOCity($countryCode = NULL) {
if ($countryCode) {
$datah = array(
"ClientId" => 'ApiIntegrationNew',
'EndUserIp' => '127.0.0.1',
'TokenId' => '24ca5e41-b7b3-424d-8105-0b42825a01d3',
"CountryCode" => $countryCode,
"SearchType" => "1"
);
$data_stringh = json_encode($datah);
$DestinationList = "http://api.tektravels.com/SharedServices/StaticData.svc/rest/GetDestinationSearchStaticData";
$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);
if ($responseTBO['Status'] && $responseTBO['Status'] == 1) {
$responseTBOsss = isset($responseTBO['Destinations']) ? $responseTBO['Destinations'] : array();
} else {
$responseTBOsss = array();
}
return $responseTBOsss;
} else {
return array();
}
}
function getTBOCountry() {
$datah = array(
"ClientId" => 'ApiIntegrationNew',
'EndUserIp' => '127.0.0.1',
'TokenId' => '24ca5e41-b7b3-424d-8105-0b42825a01d3'
);
$data_stringh = json_encode($datah);
$countryList = "http://api.tektravels.com/SharedServices/SharedData.svc/rest/CountryList";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $countryList);
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);
$responseTBOsss = json_decode(json_encode(simplexml_load_string($responseTBO['CountryList'])), true);
//echo "<pre>";print_r($responseTBOsss);exit;
// $responseTBOsss = array("Country" => array("113" => array
// (
// "Code" => "KI"
// ,"Name" => "Kiribati"
// ),
// "114" => array
// (
// "Code" => "KP"
// ,"Name" => "Korea (Democratic People's Republic Of)"
// ),
//
// "115" => array
// (
// "Code" => "KW"
// ,"Name" => "Kuwait"
// ),
//
// "116" => array
// (
// "Code" => "KG"
// ,"Name" => "Kyrgyzstan"
// ),
//
// "117" => array
// (
// "Code" => "LA"
// ,"Name" => "Lao People's Democratic Republic"
// ),
//
// "118" => array
// (
// "Code" => "LV"
// ,"Name" => "Latvia"
// ),
//
// "119" => array
// (
// "Code" => "LB"
// ,"Name" => "Lebanon"
// ),
//
// "120" => array
// (
// "Code" => "LS"
// ,"Name" => "Lesotho"
// ),
//
// "121" => array
// (
// "Code" => "LR"
// ,"Name" => "Liberia"
// ),
//
// "122" => array
// (
// "Code" => "LY"
// ,"Name" => "Libyan Arab Jamahiriya"
// ),
//
// "123" => array
// (
// "Code" => "LI"
// ,"Name" => "Liechtenstein"
// ),
//
// "124" => array
// (
// "Code" => "LT"
// ,"Name" => "Lithuania"
// ),
//
// "125" => array
// (
// "Code" => "QL"
// ,"Name" => "Lithuania (Dummy Code)"
// ),
//
// "126" => array
// (
// "Code" => "LU"
// ,"Name" => "Luxembourg"
// ),
//
// "127" => array
// (
// "Code" => "MO"
// ,"Name" => "Macau"
// ),
//
// "128" => array
// (
// "Code" => "MK"
// ,"Name" => "Macedonia"
// ),
//
// "129" => array
// (
// "Code" => "MG"
// ,"Name" => "Madagascar"
// ),
//
// "130" => array
// (
// "Code" => "MW"
// ,"Name" => "Malawi"
// ),
//
// "131" => array
// (
// "Code" => "MY"
// ,"Name" => "Malaysia"
// ),
//
// "132" => array
// (
// "Code" => "MV"
// ,"Name" => "Maldives"
// ),
//
// "133" => array
// (
// "Code" => "ML"
// ,"Name" => "Mali"
// ),
//
// "134" => array
// (
// "Code" => "MT"
// ,"Name" => "Malta"
// ),
//
// "135" => array
// (
// "Code" => "MH"
// ,"Name" => "Marshall Islands"
// ),
//
// "136" => array
// (
// "Code" => "MQ"
// ,"Name" => "Martinique"
// ),
//
// "137" => array
// (
// "Code" => "MR"
// ,"Name" => "Mauritania"
// ),
//
// "138" => array
// (
// "Code" => "MU"
// ,"Name" => "Mauritius"
// ),
//
// "139" => array
// (
// "Code" => "YT"
// ,"Name" => "Mayotte"
// ),
//
// "140" => array
// (
// "Code" => "MX"
// ,"Name" => "Mexico"
// ),
//
// "141" => array
// (
// "Code" => "MB"
// ,"Name" => "Mexico Buffer"
// ),
//
// "142" => array
// (
// "Code" => "FM"
// ,"Name" => "Micronesia"
// ),
//
// "143" => array
// (
// "Code" => "MD"
// ,"Name" => "Moldova"
// ),
//
// "144" => array
// (
// "Code" => "MC"
// ,"Name" => "Monaco"
// ),
//
// "145" => array
// (
// "Code" => "MN"
// ,"Name" => "Mongolia"
// ),
//
// "146" => array
// (
// "Code" => "MS"
// ,"Name" => "Montserrat"
// ),
//
// "147" => array
// (
// "Code" => "MA"
// ,"Name" => "Morocco"
// ),
//
// "148" => array
// (
// "Code" => "MZ"
// ,"Name" => "Mozambique"
// ),
//
// "149" => array
// (
// "Code" => "MM"
// ,"Name" => "Myanmar"
// ),
//
// "150" => array
// (
// "Code" => "NA"
// ,"Name" => "Namibia"
// ),
//
// "151" => array
// (
// "Code" => "NR"
// ,"Name" => "Nauru"
// ),
//
// "152" => array
// (
// "Code" => "NP"
// ,"Name" => "Nepal"
// ),
//
// "153" => array
// (
// "Code" => "NL"
// ,"Name" => "Netherlands"
// ),
//
// "154" => array
// (
// "Code" => "AN"
// ,"Name" => "Netherlands Antilles"
// ),
//
// "155" => array
// (
// "Code" => "NC"
// ,"Name" => "New Caledonia"
// ),
//
// "156" => array
// (
// "Code" => "NZ"
// ,"Name" => "New Zealand"
// ),
//
// "157" => array
// (
// "Code" => "NI"
// ,"Name" => "Nicaragua"
// ),
//
// "158" => array
// (
// "Code" => "NE"
// ,"Name" => "Niger"
// ),
//
// "159" => array
// (
// "Code" => "NG"
// ,"Name" => "Nigeria"
// ),
//
// "160" => array
// (
// "Code" => "NU"
// ,"Name" => "Niue"
// ),
//
// "161" => array
// (
// "Code" => "NF"
// ,"Name" => "Norfolk Islands"
// ),
//
// "162" => array
// (
// "Code" => "MP"
// ,"Name" => "Northern Mariana Islands"
// ),
//
// "163" => array
// (
// "Code" => "NO"
// ,"Name" => "Norway"
// ),
//
// "164" => array
// (
// "Code" => "OM"
// ,"Name" => "Oman"
// ),
//
// "165" => array
// (
// "Code" => "PK"
// ,"Name" => "Pakistan"
// ),
//
// "166" => array
// (
// "Code" => "PW"
// ,"Name" => "Palau"
// ),
//
// "167" => array
// (
// "Code" => "PS"
// ,"Name" => "Palestinian Occ. Territories"
// ),
//
// "168" => array
// (
// "Code" => "PA"
// ,"Name" => "Panama"
// ),
//
// "169" => array
// (
// "Code" => "PG"
// ,"Name" => "Papua New Guinea"
// ),
//
// "170" => array
// (
// "Code" => "PY"
// ,"Name" => "Paraguay"
// ),
//
// "171" => array
// (
// "Code" => "PE"
// ,"Name" => "Peru"
// ),
//
// "172" => array
// (
// "Code" => "PH"
// ,"Name" => "Philippines"
// ),
//
// "173" => array
// (
// "Code" => "PL"
// ,"Name" => "Poland"
// ),
//
// "174" => array
// (
// "Code" => "PT"
// ,"Name" => "Portugal"
// ),
//
// "175" => array
// (
// "Code" => "PR"
// ,"Name" => "Puerto Rico"
// ),
//
// "176" => array
// (
// "Code" => "QA"
// ,"Name" => "Qatar"
// ),
//
// "177" => array
// (
// "Code" => "RE"
// ,"Name" => "Reunion"
// ),
//
// "178" => array
// (
// "Code" => "RO"
// ,"Name" => "Romania"
// ),
//
// "179" => array
// (
// "Code" => "RW"
// ,"Name" => "Ruanda"
// ),
//
// "180" => array
// (
// "Code" => "RU"
// ,"Name" => "Russian Federation"
// ),
//
// "181" => array
// (
// "Code" => "LC"
// ,"Name" => "Saint Lucia"
// ),
//
// "182" => array
// (
// "Code" => "WS"
// ,"Name" => "Samoa"
// ),
//
// "183" => array
// (
// "Code" => "SM"
// ,"Name" => "San Marino"
// ),
//
// "184" => array
// (
// "Code" => "ST"
// ,"Name" => "Sao Tome & Principe"
// ),
//
// "185" => array
// (
// "Code" => "SA"
// ,"Name" => "Saudi Arabia"
// ),
//
// "186" => array
// (
// "Code" => "SN"
// ,"Name" => "Senegal"
// ),
//
// "187" => array
// (
// "Code" => "SC"
// ,"Name" => "Seychelles"
// ),
//
// "188" => array
// (
// "Code" => "SL"
// ,"Name" => "Sierra Leone"
// ),
//
// "189" => array
// (
// "Code" => "SG"
// ,"Name" => "Singapore"
// ),
//
// "190" => array
// (
// "Code" => "SK"
// ,"Name" => "Slovakia"
// ),
//
// "191" => array
// (
// "Code" => "SI"
// ,"Name" => "Slovenia"
// ),
//
// "192" => array
// (
// "Code" => "SB"
// ,"Name" => "Solomon Islands"
// ),
//
// "193" => array
// (
// "Code" => "SO"
// ,"Name" => "Somalia"
// ),
//
// "194" => array
// (
// "Code" => "ZA"
// ,"Name" => "South Africa"
// ),
//
// "195" => array
// (
// "Code" => "GS"
// ,"Name" => "South Georgia & South Sandwich"
// ),
//
// "196" => array
// (
// "Code" => "KR"
// ,"Name" => "South Korea"
// ),
// "197" => array
// (
// "Code" => "SU"
// ,"Name" => "Soviet Union"
// )
// ));
//echo "<pre>";print_r($responseTBOsss);exit;
foreach ($responseTBOsss['Country'] as $countryCode) {
$countryCode = isset($countryCode['Code']) ? trim($countryCode['Code']) : null;
$responseTBOsssff = getTBOCity($countryCode);
//echo "<pre>";print_r($responseTBOsssff);exit;
if (!empty($responseTBOsssff)) {
foreach ($responseTBOsssff as $cityData) {
$cityarray = array(
"CityId" => 0,
"TBBCityId" => $cityData['DestinationId'],
"CountryId" => 0,
"CityName" => $cityData['CityName'],
"CountryCode" => $cityData['CountryCode'],
"countryTitle" => $cityData['CountryName'],
"label" => trim($cityData['CityName']) . ' (' . trim($cityData['CountryName']) . ')',
"is_active" => true,
"is_mark_for_delete" => false
);
$checkdata = updatedata($cityarray);
// if ($cityarray['TBBCityId']) {
// $checkResult = checkdata($cityarray['TBBCityId']);
// echo "<pre>";print_r($checkResult);
// try {
// $checkJson = json_decode($checkResult, true);
// echo "<pre>";print_r($checkJson);exit;
// if (empty($checkJson)) {
// $checkdata = updatedata($cityarray);
// } else {
// $checkdata = array();
// }
// //echo "<pre>";print_r($checkdata);
// } catch (Zend_Exception $e) {
// echo $e->getMessage();
// }
// }
}
}
}
}
$responseTBO = getTBOCountry();
?>