| 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
require_once 'init.php';
$returnArray = array();
function writeLog($data) {
$fileName = date("Y-m-d") . "_Tripjackhotel.txt";
$fp = fopen($fileName, 'a+');
$data = $data . "/n";
fwrite($fp, $data);
fclose($fp);
}
function getCityData($nextURL = NULL) {
$nextUrl = 'https://api.tripjack.com/hms/v1/static-cities/';
if ($nextURL) {
$nextUrl = 'https://api.tripjack.com/hms/v1/static-cities/' . $nextURL;
}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $nextUrl,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'apikey: 810080046f570c31-07d0-41b4-86fd-1cc024eb5245',
),
));
$response = curl_exec($curl);
curl_close($curl);
$datacity = json_decode($response, true);
$returnArray = $datacity;
return $returnArray;
}
function request($i, $nextId = NULL) {
if ($nextId) {
$data = getCityData($nextId);
} else {
$data = getCityData();
}
$checkNextId = isset($data['response']['next']) ? $data['response']['next'] : NULL;
// if (isset($checkNextId)) {
$cilResponse = $data['response']['cil'];
foreach ($cilResponse as $insertedVal) {
$modelAtofollowup = new Finance_Model_Finance();
$cityId = $insertedVal['id'];
$checkCityIdArray = $modelAtofollowup->checkTripJackCity($cityId);
if (empty($checkCityIdArray)) {
$insertedData = array(
"CityId" => $cityId,
"CityName" => $insertedVal['cityName'],
"CountryId" => 555,
"CountryName" => $insertedVal['countryName']
);
$modelAtofollowup->insertTable("TripJack_City", $insertedData);
}
}
$i = $i + 1;
if ($checkNextId) {
return request($i, $checkNextId);
}
// }
// writeLog($data);
return $data;
}
$requert = request(1);