Tryag File Manager
Home
||
Turbo Force
||
B-F Config_Cpanel
Current Path :
/
home
/
ltman.eemo.co.kr
/
public_html
/
www_
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/ltman.eemo.co.kr/public_html/www_/addr_check.php
<? session_cache_limiter('no-cache, must-revalidate'); session_start(); header("Pragma: no-cache"); header("Cache-Control: no-cache,must-revalidate"); header("Content-Type: text/html; charset=utf-8"); include_once("dbconn.php"); include_once("lib.php"); foreach($_GET as $key => $value) { ${$key}=mysql_real_escape_string(trim($value)); } foreach($_POST as $key => $value) { ${$key}=mysql_real_escape_string(trim($value)); } $client_id = "jVT517A1W_jMGzdoTfaA"; $client_secret = "TzU8_y_RWA"; $encText = urlencode($addr); $url = "https://openapi.naver.com/v1/map/geocode?query=".$encText; // json $is_post = false; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, $is_post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $headers = array(); $headers[] = "X-Naver-Client-Id: ".$client_id; $headers[] = "X-Naver-Client-Secret: ".$client_secret; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec ($ch); $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close ($ch); $arr_rst=array(); if($status_code == 200) { $json_dec=json_decode($response); $lon=$json_dec->{'result'}->{'items'}[0]->{"point"}->{"x"}; $lat=$json_dec->{'result'}->{'items'}[0]->{"point"}->{"y"}; $sido=$json_dec->{'result'}->{'items'}[0]->{"addrdetail"}->{"sido"}; $sigungu=$json_dec->{'result'}->{'items'}[0]->{"addrdetail"}->{"sigugun"}; if($sido=="") { $arr_rst['rst']=-1; echo json_encode($arr_rst); //echo "<script>alert('주소지 정보가 올바르지 않습니다.');history.back();</script>"; exit; } else { $arr_rst['rst']=1; $arr_rst['sido']=urlencode($sido); $arr_rst['sigungu']=urlencode($sigungu); $arr_rst['lat']=urlencode($lat); $arr_rst['lon']=urlencode($lon); echo urldecode(json_encode($arr_rst)); } } else { $arr_rst['rst']=-1; echo json_encode($arr_rst); //echo "<script>alert('주소지 정보가 올바르지 않습니다.');history.back();</script>"; exit; } ?>