2012-03-20 2 views

답변

5

:

http://ipinfodb.com/ip_location_api_json.php

http://www.ipaddressapi.com/ ($)

또는 것은 같은 다른 소스에서 데이터를 얻을 관리 :

http://www.iplocation.net/

http://ip2loc.jerodsanto.net/

+0

언급 할 가치가 또 다른 하나 http://www.maxmind.com/app/ip-location (무료 버전은 있지만 유료 버전 만 도시가 있습니다.) 정확하다면 정확함) – Corbin

+0

이 방법은 끔찍하게 부정확 할 수도 있습니다. 당신이 말할 수있는 가장 가까운 곳은 "영국"입니다. –

0

다른 소스는 다음과 같습니다. https://www.geoip-db.com JSON 및 JSONP 콜백 솔루션을 제공합니다.

JQuery와 예 :

<!DOCTYPE html> 
<html> 
<head> 
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/> 
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> 
<title>Geo City Locator</title> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> 
</head> 
<body > 
    <div>Country: <span id="country"></span></div> 
    <div>State: <span id="state"></spa></div> 
    <div>City: <span id="city"></span></div> 
    <div>Latitude: <span id="latitude"></span></div> 
    <div>Longitude: <span id="longitude"></span></div> 
    <div>IP: <span id="ip"></span></div>  

    <script> 
     $.getJSON('https://geoip-db.com/json/geoip.php?jsonp=?').done(function(location) { 
     $('#country').html(location.country_name); 
     $('#state').html(location.state); 
     $('#city').html(location.city); 
     $('#latitude').html(location.latitude); 
     $('#longitude').html(location.longitude); 
     $('#ip').html(location.IPv4);    
    }); 
</script> 

관련 문제