3초기억력

도로명, 지번, 신 우편번호 5자리 검색하기. 공공데이터 우편번호 api 사용. (ASP) 본문

플밍_ASP

도로명, 지번, 신 우편번호 5자리 검색하기. 공공데이터 우편번호 api 사용. (ASP)

잠수콩 2016. 7. 29. 15:51
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.



제목 : 도로명, 지번, 신 우편번호 5자리 검색하기. 공공데이터 우편번호 api 사용. (ASP)




소스 :



<%@Language="VBScript" CODEPAGE="65001" %>

<%

    Response.CharSet="utf-8"

    Session.codepage="65001"

    Response.codepage="65001"

    Response.ContentType="text/html;charset=utf-8"

%>

<!doctype html>

<html lang="en">

 <head>

  <meta charset="UTF-8">

  <meta name="Generator" content="EditPlus®">

  <meta name="Author" content="">

  <meta name="Keywords" content="">

  <meta name="Description" content="">

  <title>Document</title>

 </head>

 <body>

 <%

address = request("address")

 %>

 <form name="Frm" method="post" action="index.asp">

<input type="text" name="address" value="<%=address%>" />

<input type="submit" value="전송" />

 </form>

<%

address = server.urlencode(address)

strkey1 = "인증키입력"


strUrl = "http://openapi.epost.go.kr/postal/retrieveNewAdressAreaCdSearchAllService/retrieveNewAdressAreaCdSearchAllService/getNewAddressListAreaCdSearchAll?countPerPage=10&currentPage=1&ServiceKey="&strkey1&"&srchwrd="&address



    Set objXmlHttp = server.CreateObject("Msxml2.ServerXMLHTTP.3.0")

    objXmlHttp.open "GET", strUrl, false

    objXmlHttp.send

status = objXmlHttp.status


    strResponseText = objXmlHttp.responseText

    Set objXmlHttp = Nothing


    Set objMsXmlDom = Server.CreateObject("microsoft.XMLDOM")

    objMsXmlDom.async = False

    objMsXmlDom.loadXML(strResponseText)




Set NodeList = objMsXmlDom.documentElement.selectNodes("//NewAddressListResponse/cmmMsgHeader")

For Each Node In NodeList

    Set AddrNode = Node.selectSingleNode("responseTime/text()")

    if not AddrNode Is Nothing then response.write "responseTime=" &AddrNode.nodeValue & "<br/>"

    set AddrNode = nothing

    Set AddrNode = Node.selectSingleNode("successYN/text()")

    if not AddrNode Is Nothing then response.write "successYN=" &AddrNode.nodeValue & "<br/>"

    set AddrNode = nothing

    Set AddrNode = Node.selectSingleNode("returnCode/text()")

    if not AddrNode Is Nothing then response.write "returnCode=" &AddrNode.nodeValue & "<br/>"

    set AddrNode = nothing

    Set AddrNode = Node.selectSingleNode("totalCount/text()")

    if not AddrNode Is Nothing then response.write "totalCount=" & AddrNode.nodeValue & "<br/>"

    set AddrNode = nothing

    Set AddrNode = Node.selectSingleNode("countPerPage/text()")

    if not AddrNode Is Nothing then response.write "countPerPage=" &AddrNode.nodeValue & "<br/>"

    set AddrNode = nothing

    Set AddrNode = Node.selectSingleNode("totalPage/text()")

    if not AddrNode Is Nothing then response.write "totalPage=" &AddrNode.nodeValue & "<br/>"

    set AddrNode = nothing


    Set AddrNode = Node.selectSingleNode("currentPage/text()")

    if not AddrNode Is Nothing then response.write "currentPage=" &AddrNode.nodeValue & "<br/>"

    set AddrNode = nothing



Next


Set NodeList = Nothing



Set NodeList = objMsXmlDom.documentElement.selectNodes("//NewAddressListResponse/newAddressListAreaCdSearchAll")

For Each Node In NodeList

    Set AddrNode = Node.selectSingleNode("zipNo/text()")

    if not AddrNode Is Nothing then response.write AddrNode.nodeValue & "<br/>"

    set AddrNode = nothing

    Set AddrNode = Node.selectSingleNode("lnmAdres/text()")

    if not AddrNode Is Nothing then response.write AddrNode.nodeValue & "<br/>"

    set AddrNode = nothing

    Set AddrNode = Node.selectSingleNode("rnAdres/text()")

    if not AddrNode Is Nothing then response.write AddrNode.nodeValue & "<br/>"

    set AddrNode = nothing

Next


Set NodeList = Nothing


    Set objMsXmlDom = Nothing

%>


 </body>

</html>




내용 :


인증키 발급방법, 순서

   1, 회원가입 : http://www.data.go.kr (공공데이터 포털)

   2, 회원로그인

   3, 메인 메뉴중 [오픈 API] 클릭 -> 통합검색폼에서 '우편번호' 라고 검색하면

       '우편번호 정보' 라는 항목이 찾아짐.

   4, [활용신청] 버튼 클릭해서 '개발계정 신청' 양식을 작성함.

       * 시스템유형 : 일반

       * 활용목적 : 웹개발

       * 기타항목 : 입렵하라는 건 다 입력해줌

    5, 신청서 전송하면 실시간 승인완료 되고 인증키도 바로 발급됨

    6, 마이페이지 -> OPEN API -> 개발계정 -> 검색결과 -> 인증키 확인


인증키는 인코딩된 형태로 제공됨.



#상세 기능 설명


새우편번호 정보 : 도로명주소 및 지번주소를 페이지당 출력될 개수와 출력될 페이지에 맞춰 5자리 우편번호와 도로명주소 및 지번주소의 상세내역을 조회해주는 우편번호 정보조회 서비스






예제 소스 파일 :


 출처 :  https://www.data.go.kr




Comments