Tryag File Manager
Home
||
Turbo Force
||
B-F Config_Cpanel
Current Path :
/
home
/
nonga.eemo.co.kr
/
public_html
/
www
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/nonga.eemo.co.kr/public_html/www/addr_check_autocom.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)); } function request($path, $query, $content_type = 'json') { $api_server = 'https://dapi.kakao.com'; $headers = array('Authorization: KakaoAK d4e624e15429967d2a33af07ba75f8f3 '); $opts = array( CURLOPT_URL => $api_server . $path . '.' . $content_type . '?' . $query, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSLVERSION => 1, CURLOPT_HEADER => false, CURLOPT_HTTPHEADER => $headers ); $curl_session = curl_init(); curl_setopt_array($curl_session, $opts); $return_data = curl_exec($curl_session); if (curl_errno($curl_session)) { throw new Exception(curl_error($curl_session)); } else { //print_r(curl_getinfo($curl_session)); curl_close($curl_session); return $return_data; } } $path = '/v2/local/search/address'; $content_type = 'json'; // json or xml $params = http_build_query(array( 'query' => $addr )); $res = request($path, $params, $content_type); //echo $res."<br><br>"; $json=json_decode($res); $arr_rst=array(); if($json->meta->total_count=='0') { } else { $arr=array(); foreach($json->documents as $ak => $av) { $obj=(object) $c; if($av->road_address->region_1depth_name) { //echo $av->address_name."<br>"; $obj->ID=($ak+1); $obj->MAIN_NAME=urlencode($av->road_address->region_1depth_name); $obj->SUB_NAME=urlencode($av->road_address->region_2depth_name); $obj->DETAIL_NAME=urlencode($av->road_address->region_3depth_name); $obj->FULL_ADDR=urlencode($av->address_name); $arr[]=$obj; } else if($av->address->region_1depth_name) { //echo $av->address_name."<br>"; $obj->ID=($ak+1); $obj->MAIN_NAME=urlencode($av->address->region_1depth_name); $obj->SUB_NAME=urlencode($av->address->region_2depth_name); $obj->DETAIL_NAME=urlencode($av->address->region_3depth_name); $obj->FULL_ADDR=urlencode($av->address_name); $arr[]=$obj; } } echo urldecode(json_encode($arr)); } ?>