Google Code Prettify

[JSON]取得用戶 IP 及衛星定位相關資料

Geobytes

$.getJSON('http://gd.geobytes.com/GetCityDetails?callback=?', function(data) {
  console.log(JSON.stringify(data, null, 2));
});
Returns:
?({"geobytesforwarderfor":"","geobytesremoteip":"1.171.128.150","geobytesipaddress":"1.171.128.150","geobytescertainty":"100","geobytesinternet":"TW","geobytescountry":"Taiwan","geobytesregionlocationcode":"TWTP","geobytesregion":"T'ai-pei","geobytescode":"TP","geobyteslocationcode":"TWTPTAIP","geobytesdma":"0","geobytescity":"Taipei","geobytescityid":"6744","geobytesfqcn":"Taipei, TP, Taiwan","geobyteslatitude":"25.017000","geobyteslongitude":"121.449997","geobytescapital":"Taipei","geobytestimezone":"+08:00","geobytesnationalitysingular":"Taiwanese","geobytespopulation":"22370461","geobytesnationalityplural":"Taiwanese","geobytesmapreference":"Southeast Asia ","geobytescurrency":"New Taiwan Dollar","geobytescurrencycode":"TWD","geobytestitle":"Taiwan"});




geoPlugin

$.getJSON('http://www.geoplugin.net/json.gp?jsoncallback=?', function(data) {
  console.log(JSON.stringify(data, null, 2));
});
Returns:
%3F({
  "geoplugin_request":"1.171.128.150",
  "geoplugin_status":200,
  "geoplugin_delay":"2ms",
  "geoplugin_credit":"Some of the returned data includes GeoLite data created by MaxMind, available from <a href='http:\/\/www.maxmind.com'>http:\/\/www.maxmind.com<\/a>.",
  "geoplugin_city":"Taoyuan District",
  "geoplugin_region":"Taoyuan",
  "geoplugin_regionCode":"TAO",
  "geoplugin_regionName":"Taoyuan",
  "geoplugin_areaCode":"",
  "geoplugin_dmaCode":"",
  "geoplugin_countryCode":"TW",
  "geoplugin_countryName":"Taiwan",
  "geoplugin_inEU":0,
  "geoplugin_euVATrate":false,
  "geoplugin_continentCode":"AS",
  "geoplugin_continentName":"Asia",
  "geoplugin_latitude":"24.9896",
  "geoplugin_longitude":"121.3187",
  "geoplugin_locationAccuracyRadius":"10",
  "geoplugin_timezone":"Asia\/Taipei",
  "geoplugin_currencyCode":"TWD",
  "geoplugin_currencySymbol":"NT$",
  "geoplugin_currencySymbol_UTF8":"NT$",
  "geoplugin_currencyConverter":30.766
})



ipapi.co

$.getJSON('https://ipapi.co/json/', function(data) {
  console.log(JSON.stringify(data, null, 2));
});
Returns:
{
    "ip": "2001:b011:6c08:aee:c416:899e:f845:f0b5",
    "city": "Taoyuan District",
    "region": "Taoyuan",
    "region_code": "TAO",
    "country": "TW",
    "country_name": "Taiwan",
    "continent_code": "AS",
    "in_eu": false,
    "postal": null,
    "latitude": 24.9896,
    "longitude": 121.3187,
    "timezone": "Asia/Taipei",
    "utc_offset": "+0800",
    "country_calling_code": "+886",
    "currency": "TWD",
    "languages": "zh-TW,zh,nan,hak",
    "asn": "AS3462",
    "org": "Data Communication Business Group"
}



IP-API.com

$.getJSON('http://ip-api.com/json?callback=?', function(data) {
  console.log(JSON.stringify(data, null, 2));
});
Returns:
?({"as":"AS3462 Data Communication Business Group","city":"Taoyuan District","country":"Taiwan","countryCode":"TW","isp":"HiNet","lat":24.9896,"lon":121.3187,"org":"HiNet","query":"1.171.128.150","region":"TAO","regionName":"Taoyuan","status":"success","timezone":"Asia/Taipei","zip":""});




ipify

$.getJSON('https://api.ipify.org?format=jsonp&callback=?', function(data) {
  console.log(JSON.stringify(data, null, 2));
});
Returns:

?({"ip":"1.171.128.150"});





ipinfo.io

$.getJSON('https://ipinfo.io/json', function(data) {
  console.log(JSON.stringify(data, null, 2));
});
Returns:
{
  "ip": "1.171.128.150",
  "hostname": "1-171-128-150.dynamic-ip.hinet.net",
  "city": "Taoyuan District",
  "region": "Taoyuan",
  "country": "TW",
  "loc": "24.9896,121.3190",
  "org": "AS3462 Data Communication Business Group"
}



JSON Test

$.getJSON('http://ip.jsontest.com/?callback=?', function(data) {
  console.log(JSON.stringify(data, null, 2));
});
Returns:
?({"ip": "2001:b011:6c08:aee:c416:899e:f845:f0b5"});