17 if(!isset($this->module_config))
39 return $this->module_config;
51 $values = array_values($values);
54 if(count($values) == 4 && preg_match(
'/^\(?[0-9a-z\x20-]{5,10}\)?$/i', trim($values[0])))
59 $values = implode(
' ', $values);
62 $output = array(
'', trim(preg_replace(
'/\s+/',
' ', $values)),
'',
'',
'');
65 if(preg_match(
'/\(?([0-9-]{5,7})\)?/',
$output[1], $matches))
67 $output[1] = trim(preg_replace(
'/\s+/',
' ', str_replace($matches[0],
'',
$output[1])));
72 if(preg_match(
'/\(.+\s.+[읍면동리(마을)(0-9+가)]\s[0-9-]+\)/',
$output[1], $matches))
79 if(preg_match(
'/\(.+[읍면동리(마을)(0-9+가)](?:,.*)?\)/u',
$output[1], $matches))
86 if(preg_match(
'/^(.+ [가-힝]+[0-9]*[동리로길]\s*[0-9-]+(?:번지?)?),?\s+(.+)$/u',
$output[1], $matches))
102 $module_config = $this->getConfig();
103 if($module_config->api_handler != 1)
105 return $this->makeObject(-1,
'msg_invalid_request');
112 $query = trim(strval($query));
115 return $this->stop(
'msg_krzip_no_query');
118 $output = $this->getEpostapiSearch($query);
120 $this->add(
'address_list',
$output->get(
'address_list'));
138 $encoding = strtoupper(mb_detect_encoding($query));
139 if($encoding !==
'EUC-KR')
141 $query = iconv($encoding,
'EUC-KR', $query);
144 $module_config = $this->getConfig();
145 $regkey = $module_config->epostapi_regkey;
148 'target' =>
'postNew',
153 'accept-language' =>
'ko'
155 $request_config = array(
156 'ssl_verify_peer' => FALSE
160 self::$epostapi_host,
164 'application/x-www-form-urlencoded',
172 $result = $oXmlParser->parse($buff);
175 $err_msg = trim($result->error->message->body);
178 $err_code = intval(str_replace(
'ERR-',
'', $result->error->error_code->body));
182 $err_msg =
'msg_krzip_is_maintenance';
185 $err_msg =
'msg_krzip_wrong_regkey';
188 $err_msg =
'msg_krzip_no_result';
191 $err_msg =
'msg_krzip_riddling_wrong';
196 return $this->makeObject(-1, $err_msg);
200 return $this->makeObject(-1,
'msg_krzip_riddling_wrong');
203 $item_list = $result->post->itemlist->item;
204 if(!is_array($item_list))
206 $item_list = array($item_list);
210 return $this->makeObject(-1,
'msg_krzip_no_result');
213 $addr_list = array();
214 foreach($item_list as $key => $val)
216 $postcode = $val->postcd->body;
217 $road_addr = $val->address->body;
218 $jibun_addr = $val->addrjibun->body;
222 if(preg_match(
'/\((?<detail>.+[읍면동리(마을)(0-9+가)](?:,.*)?)\)/', $road_addr, $matches))
224 $road_addr = trim(str_replace($matches[0],
'', $road_addr));
225 $extra =
'(' . $matches[
'detail'] .
')';
227 if(preg_match(
'/\((?<detail>.+[읍면동리(마을)(빌딩)(0-9+가)](?:,.*)?)\)/', $jibun_addr, $matches))
229 $jibun_addr =
'(' . trim(str_replace($matches[0],
'', $jibun_addr)) .
')';
232 $addr_list[] = array(
242 $output->add(
'address_list', $addr_list);
256 $template_config = $this->getConfig();
257 $template_config->sequence_id = ++self::$sequence_id;
258 $template_config->column_name = $column_name;
259 $template_config->values = $this->getMigratedPostcode($values);
262 $api_name = strval(self::$api_list[$template_config->api_handler]);
264 $output = $oTemplate->compile($this->module_path .
'tpl',
'template.' . $api_name);
getMigratedPostcode($values)
여러 포맷의 우편번호를 모듈 표준 포맷으로 변환
debugPrint($debug_output=NULL, $display_option=TRUE, $file= '_debug_message.php')
set($key, $val, $set_to_get_vars=0)
getKrzipCodeList($query)
외부 서버로부터 주소 검색 결과 반환
getConfig()
한국 우편번호 모듈 설정 반환
getEpostapiSearch($query= '')
우체국 우편번호 API 검색 결과 반환
getRemoteResource($url, $body=null, $timeout=3, $method= 'GET', $content_type=null, $headers=array(), $cookies=array(), $post_data=array(), $request_config=array())
getKrzipCodeSearchHtml($column_name, $values)
HTML 입력 폼 반환
Krzip module model class.