내 공인 아이피 주소
예제
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"
%><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>내 공인 아이피 주소 조회 예제</title>
<script type="text/javascript">
// 의존성 없는 예제를 위해 순수 JavaScript 기반 처리
var ip = "";
function getIP(json) {
ip = json.ip;
}
window.onload = function() {
document.getElementById("test").value = ip;
}
</script>
<script type="application/javascript" src="https://api.ipify.org?format=jsonp&callback=getIP"></script>
</head>
<body>
<div style="text-align: center;">
<h3 style="font-size: 2.5em; color: green;font-weight: bold;">내 공인 아이피 주소</h3>
<input type="text" id="test" style="text-align: center; font-size: 2.5em; border: 0px;width: 280px;" onclick="this.select();" readonly="readonly">
</div>
</body>
</html>※ 아이피 조회 API 출처 링크
'촌놈 - 취미로하는개발 > 자료실' 카테고리의 다른 글
| Youtube API V3 예제(Example) JDK1.7 으로 검색 및 가져오기 (0) | 2021.02.16 |
|---|---|
| URL 인코딩, 디코딩 예제 프로그램 (0) | 2018.11.06 |