• IP 查询


    public static IpAddressModel GetDetailIp(string IpAddress)
    {
    string url = "http://ip-api.com/json/" + IpAddress + "?lang=zh-CN";
    WebRequest wrt = null;
    WebResponse wrp = null;
    wrt = WebRequest.Create(url);
    wrt.Credentials = CredentialCache.DefaultCredentials;
    wrp = wrt.GetResponse();
    StreamReader sr = new StreamReader(wrp.GetResponseStream(), Encoding.UTF8);
    //获取到的是Json数据
    string html = sr.ReadToEnd();
    IpAddressModel m = JsonConvert.DeserializeObject<IpAddressModel>(html);
    return m;
    }

    public class IpAddressModel
    {

    public string status { get; set; }
    public string country { get; set; }
    public string countryCode { get; set; }
    public string region { get; set; }
    public string regionName { get; set; }
    public string city { get; set; }
    public string zip { get; set; }
    public double lat { get; set; }
    public double lon { get; set; }
    public string timezone { get; set; }
    public string isp { get; set; }

    public string org { get; set; }
    public string query { get; set; }
    }

  • 相关阅读:
    Git
    Shell-sed之替换字符
    Linux IO/NFS tunning 性能优化及检测
    利用Java Flight Recorder(JFR)诊断timing及内存问题
    Get/Post
    SQL-1
    HTTP协议简要
    nmap简单使用
    (C语言)买东西找零钱
    今日错误(C语言)(定义二维数组储存)
  • 原文地址:https://www.cnblogs.com/AzureAD/p/14086369.html
Copyright © 2020-2023  润新知