获得外网IP(偷资源)

private string getByIp()
{
string strUrl = "http://iframe.ip138.com/ic.asp"; //获得IP的网址了
WebClient w = new WebClient();
Stream s= w.OpenRead(strUrl);
int i = 0;
string str = "";
do
{
i = s.ReadByte();
if (i > 0)
str += Convert.ToChar(i);
}
while (i > 0);
int ii = str.IndexOf('[');
string strstr = "";
string strss = "";
if (ii != -1)
{
for (int k = ii+1; k < str.Length - 1; k++)
{
strstr += str[k];
}
string[] ss= strstr.Split('.');
for (int j = 0; j < ss.Length ; j++)
{
if (j == 3)
{
strss += ss[j].Split(']')[0];
}
else
{
strss += ss[j] + ".";
}
}
}
return strss;
}