ÿØÿà JFIF ` ` ÿþ
Server : Apache System : Linux ruga7-004.fmcity.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : tkt_travelbus ( 1137) PHP Version : 7.0.0p1 Disable Function : mysql_pconnect Directory : /tkt_travelbus/www/admin/exchange/getExternalData/ |
Upload File : |
<?php include $_SERVER['DOCUMENT_ROOT']."/Lib/config.php"; include $_SERVER['DOCUMENT_ROOT']."/Lib/common.lib.php"; include $_SERVER['DOCUMENT_ROOT']."/Lib/connect.php"; /** * exchange currey Ins TWD * https://www.tktravelkorea.com/admin/exchange/getExternalData/?exchange=TWD * * CREATE TABLE `API_EXCHANGE_DATA` ( * `ID` int(11) NOT NULL AUTO_INCREMENT, * `ins_dt` date DEFAULT NULL COMMENT '저장일시', * `currency` varchar(5) DEFAULT NULL COMMENT '통화단위,홍콩 HKD,미국 USD, 대만 TWD', * `value` varchar(10) DEFAULT NULL COMMENT '1달러당 KRW', PRIMARY KEY (`ID`) * ) ENGINE=MyISAM CHARSET=utf8 * * * * CREATE TABLE `API_EXCHANGE_DATA` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `ins_dt` date DEFAULT NULL COMMENT '저장일시', `HKD` varchar(10) DEFAULT NULL COMMENT '홍콩 HKD', `TWD` varchar(10) DEFAULT NULL COMMENT '대만 TWD', `USD` varchar(10) DEFAULT NULL COMMENT '미국 USD', `ins_dt_date` datetime NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM AUTO_INCREMENT=31 DEFAULT CHARSET=utf8 */ $curl = curl_init(); $currency = $_GET['exchange']; $url = "https://quotation-api-cdn.dunamu.com/v1/forex/recent?codes=FRX.KRWUSD"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); $htmlCode = curl_exec($curl); curl_close($curl); $data = json_decode($htmlCode, true); echo '<pre>'; var_dump($htmlCode); echo '</pre>'; $usdPrice = $data[0]['basePrice']; exit; $curl = curl_init(); $currency = $_GET['exchange']; $url = "https://quotation-api-cdn.dunamu.com/v1/forex/recent?codes=FRX.KRWTWD"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); $htmlCode = curl_exec($curl); curl_close($curl); $data = json_decode($htmlCode, true); $twdTotalData = $data; $twdPrice = $data[0]['basePrice']; $curl = curl_init(); $currency = $_GET['exchange']; $url = "https://quotation-api-cdn.dunamu.com/v1/forex/recent?codes=FRX.KRWHKD"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); $htmlCode = curl_exec($curl); curl_close($curl); $data = json_decode($htmlCode, true); $hkdTotalData = $data; $hkdPrice = $data[0]['basePrice']; $curl = curl_init(); $currency = $_GET['exchange']; $url = "https://quotation-api-cdn.dunamu.com/v1/forex/recent?codes=FRX.KRWCNY"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); $htmlCode = curl_exec($curl); curl_close($curl); $data = json_decode($htmlCode, true); $cnyTotalData = $data; $cnyPrice = $data[0]['basePrice']; $curl = curl_init(); $currency = $_GET['exchange']; $url = "https://quotation-api-cdn.dunamu.com/v1/forex/recent?codes=FRX.KRWSGD"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); $htmlCode = curl_exec($curl); curl_close($curl); $data = json_decode($htmlCode, true); $sgdTotalData = $data; $sgdPrice = $data[0]['basePrice']; $curl = curl_init(); $currency = $_GET['exchange']; $url = "https://quotation-api-cdn.dunamu.com/v1/forex/recent?codes=FRX.KRWMYR"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); $htmlCode = curl_exec($curl); curl_close($curl); $data = json_decode($htmlCode, true); $myrTotalData = $data; $myrPrice = $data[0]['basePrice']; $curl = curl_init(); $currency = $_GET['exchange']; $url = "https://quotation-api-cdn.dunamu.com/v1/forex/recent?codes=FRX.KRWTHB"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); $htmlCode = curl_exec($curl); curl_close($curl); $data = json_decode($htmlCode, true); $thbTotalData = $data; $thbPrice = $data[0]['basePrice']; $curl = curl_init(); $currency = $_GET['exchange']; $url = "https://quotation-api-cdn.dunamu.com/v1/forex/recent?codes=FRX.KRWPHP"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); $htmlCode = curl_exec($curl); curl_close($curl); $data = json_decode($htmlCode, true); $phpTotalData = $data; $phpPrice = $data[0]['basePrice']; $curl = curl_init(); $currency = $_GET['exchange']; $url = "https://quotation-api-cdn.dunamu.com/v1/forex/recent?codes=FRX.KRWJPY"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); $htmlCode = curl_exec($curl); curl_close($curl); $data = json_decode($htmlCode, true); $jpyTotalData = $data; $jpyPrice = $data[0]['basePrice']; $sql = "INSERT INTO API_EXCHANGE_DATA_TOTAL SET HKD = '{$hkdTotalData}', TWD = '{$twdTotalData}', USD = '{$usdTotalData}', CNY = '{$cnyTotalData}', SGD = '{$sgdTotalData}', MYR = '{$myrTotalData}', THB = '{$thbTotalData}', PHP = '{$phpTotalData}', JPY = '{$jpyTotalData}', ins_dt = NOW(),ins_dt_date = NOW()"; db_query($sql); $sql = "INSERT INTO API_EXCHANGE_DATA SET HKD = '{$hkdPrice}', TWD = '{$twdPrice}', USD = '{$usdPrice}', CNY = '{$cnyPrice}', SGD = '{$sgdPrice}', MYR = '{$myrPrice}', THB = '{$thbPrice}', PHP = '{$phpPrice}', JPY = '{$jpyPrice}', ins_dt = NOW(),ins_dt_date = NOW()"; db_query($sql); if($_POST['mode'] == 'exchangeDataGet'){ $nowTime = date("Y-m-d H:i:s",time()); echo json_encode( array( 'result' => true, 'HKD' => number_format($hkdPrice,2), 'TWD' => number_format($twdPrice,2), 'USD' => number_format($usdPrice,2), 'CNY' => number_format($cnyPrice,2), 'SGD' => number_format($sgdPrice,2), 'MYR' => number_format($myrPrice,2), 'THB' => number_format($thbPrice,2), 'PHP' => number_format($phpPrice,2), 'JPY' => number_format($jpyPrice,2), 'getDate' => $nowTime, ) ); } exit; ?>