static string GetIP()
{
Uri uri = new Uri(" http://www.ikaka.com/ip/index.asp";);
System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(uri);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = 0;
req.CookieContainer = new System.Net.CookieContainer();
req.GetRequestStream().Write(new byte [0], 0, 0);
System.Net.HttpWebResponse res = (System.Net.HttpWebResponse)(req.GetResponse());
StreamReader rs = new StreamReader(res.GetResponseStream(), System.Text.Encoding.GetEncoding("GB18030"));
string s = rs.ReadToEnd();
rs.Close();
req.Abort();
res.Close();
System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(s, @"IP:/[(?<IP>[0-9/.]*)/]");
if (m.Success) return m.Groups["IP"].Value;
return string.Empty;
}
{
Uri uri = new Uri(" http://www.ikaka.com/ip/index.asp";);
System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(uri);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = 0;
req.CookieContainer = new System.Net.CookieContainer();
req.GetRequestStream().Write(new byte [0], 0, 0);
System.Net.HttpWebResponse res = (System.Net.HttpWebResponse)(req.GetResponse());
StreamReader rs = new StreamReader(res.GetResponseStream(), System.Text.Encoding.GetEncoding("GB18030"));
string s = rs.ReadToEnd();
rs.Close();
req.Abort();
res.Close();
System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(s, @"IP:/[(?<IP>[0-9/.]*)/]");
if (m.Success) return m.Groups["IP"].Value;
return string.Empty;
}