using System;using System.Net;using System.Text.RegularExPRessions;namespace Keleyi.Com{ public class GetInternetip { public static string GetIP() { using (var webClient = new WebClient()) { try { var temp = webClient.DownloadString("http://iframe.ip138.com/ic.asp"); var ip = Regex.Match(temp, @"/[(?<ip>/d+/./d+/./d+/./d+)]").Groups["ip"].Value; return !string.IsNullOrEmpty(ip) ? ip : null; } catch (Exception ex) { return ex.Message; } } } }}
新闻热点
疑难解答