#region 根據ip獲取地點 /// 獲取Ip歸屬地 /// </summary> /// <param name="ip">ip</param> /// <returns>歸屬地</returns> public static string GetIpAddress(string ip) { ...
#region 根據ip獲取地點
/// 獲取Ip歸屬地
/// </summary>
/// <param name="ip">ip</param>
/// <returns>歸屬地</returns>
public static string GetIpAddress(string ip)
{
JavaScriptSerializer Jss = new JavaScriptSerializer();
//http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=218.192.3.42 調用新浪的介面
string address = string.Empty;
try
{
string reText = WebRequestPostOrGet("http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=" + ip, "");
Dictionary<string, object> DicText = (Dictionary<string, object>)Jss.DeserializeObject(reText);
address = DicText["city"].ToString();
//Log.Loger("city:" + address, true);
}
catch { }
return address;
}
#endregion