using (var client = new WebClient())
{
client.Encoding = Encoding.UTF8;
string serviceAddress = "https://api.ipify.org/?format=json";//请求URL地址
var data = client.DownloadString(serviceAddress);
var obj = JsonConvert.DeserializeObject<JObject>(data);
string s = obj["ip"].ToString();
Console.Write(s);
}
标签:string,ipify,C#,client,IP地址,var
From: https://www.cnblogs.com/qq673613920/p/17005971.html