웹 사이트 또는 블로그에 접속한 사용자들의 IP를 이용하면 어떤 국가의 어느 위치에서 접속을 하였는지 알 수 있습니다물론 내부 망이 아닌 공인 IP로 변경되는 위치이기 때문에 위치 정보는 100% 정확하다고 할 수 는 없습니다.

각 국가별 IP 주소 대역을 찾아 보려면

https://xn--3e0bx5euxnjje69i70af08bea817g.xn--3e0b707e/jsp/infoboard/stats/ipCurrent.jsp

여기에 가면 있습니다그런대 양이 장난 아니게 많습니다. csv 파일로 190,350라인(2019.12.31기준) 이나 되서 접속자 정보를 개인이 분석 하기는 귀찮고 대신 작업을 해주는 곳을 이용 하면 됩니다몇 군대 알아 볼까요?

 

http://ip-api.com


http://ip-api.com


사용 방법들은 대부분 비슷 합니다.  스크립트를 볼까요?

<!DOCTYPE html>

<html>

<head>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

    <script >

 

    $.get("http://ip-api.com/json", function(data) {

           console.log(data);

           $("#cty").text(data.country);

    }, "jsonp");

</script>

</head>

<body>

<span id="cty">where</span>

</body>

</html>


조회하면 리턴하는 값들은 아래와 같습니다.


ip info nation location



http://ipinfo.io


http://ipinfo.io


이번에는 다른 사이트를 이용해 봅니다. 값을 받기 위한 스크립트 입니다.


<!DOCTYPE html>

<html>

<head>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

    <script >

 

    $.getJSON("http://ipinfo.io", function(data) {

           console.log(data);

           $("#cty").text(data.country);

    });

</script>

</head>

<body>

<span id="cty">where</span>

</body>

</html>


그리고 리턴받은 값 입니다.


ip info nation location


https://extreme-ip-lookup.com/json


https://extreme-ip-lookup.com/json


마지막으로 사용해볼 사이트 이고 사용하는 스크립트 입니다.  이번에는 주소가 귀찮게 길군요. 사용법은 비슷하게..


<!DOCTYPE html>

<html>

<head>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

    <script >

 

    $.getJSON("https://extreme-ip-lookup.com/json", function(data) {

           console.log(data);

           $("#cty").text(data.country);

    });

</script>

</head>

<body>

<span id="cty">where</span>

</body>

</html> 


리턴받은 값 입니다.


ip info nation location

3개가 조금씩 정보의 종류가 다릅니다대부분의 정보는 서로 동일 한데 위치 정보는 조금씩 차이가 나는데 한번씩 테스트 해보시면 알 수 있습니다접속자에 대한 정보가 필요할 때 간편하게 사용 할 수 있는 방법인것 같습니다.


- copy coding -


+ Recent posts