古老的问题。需要找到解决方案。
此:
$。getJSON(“http://jsonip.appspot.com?callback=?”,function(data){ip = data.ip});
似乎不再起作用了:
App Engine Error
Over Quota
This Google App Engine application is temporarily over its serving quota.
Please try again later.
我发现了http://checkip.dyndns.org/
我使用load(数据类型设置为jsonp)来尝试获取html,但我不认为我做得对,或者只是无法完成。
任何帮助?
感谢筹码; - )
答案 0 :(得分:5)
使用以下代码创建一个php文件:
echo'[{“ip”:“$ _SERVER ['REMOTE_ADDR']”}]';
然后用get JSON
ping它答案 1 :(得分:2)
<!-- Require jQuery / Anyversion --><script type="text/javascript" language="Javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<!-- Require EasyJQuery After JQuery --><script type="text/javascript" language="Javascript" src="http://api.easyjquery.com/easyjquery.js"></script>
<script type="text/javascript" language="Javascript">
// 1. Your Data Here
function my_callback(json) {
alert("IP :" + json.IP + " \nCountry: " + json.Country);
}
function my_callback2(json) {
// more information at http://api.easyjquery.com/test/demo-ip.php
alert("IP :" + json.IP + " \nCountry: " + json.Country + " City: " + json.CityName + " RegionName: " + json.RegionName);
}
// 2. Setup Callback Function
// EasyjQuery_Get_IP("my_callback"); // fastest version
EasyjQuery_Get_IP("my_callback2","full"); // full version
</script>
[IP] => 93.154.204.205
[ContinentCode] => NA
[ContinentName] => North America
[CountryCode2] => US
[CountryCode3] => USA
[COUNTRY] => US
[CountryName] => United States
[RegionName] => California
[CityName] => Garden Grove
[CityLatitude] => 33.7831
[CityLongitude] => -118.0271
[CountryLatitude] => 38
[CountryLongitude] => -98
[LocalTimeZone] => America/Los_Angeles
[REMOTE_ADDR] => 77.93.210.64
[HTTP_X_FORWARDED_FOR] =>
[CallingCode] => 1
[Population] => 307,212,123 (3)
[AreaSqKm] => 9,826,675 (4)
[GDP_USD] => 14.26 Trillion (1)
[Capital] => Washington, D.C.
[Electrical] => 120 V,60 Hz Type A Type B
[Languages] => English 82.1%, Spanish 10.7%, other Indo-European 3.8%, Asian and Pacific island 2.7%, other 0.7% (2000 census)
[Currency] => US Dollar (USD)
[Flag] => http://api.easyjquery.com/proips/flags/US.jpg