- 最后登录
- 2016-8-29
- 注册时间
- 2012-8-25
- 阅读权限
- 90
- 积分
- 23585
- 纳金币
- 20645
- 精华
- 62
|
- using System;
-
- using System.Net;
-
- using System.Text.RegularExpressions;
-
- namespace ConsoleApplication1
-
- {
-
- class Program
-
- {
-
- static void Main(string[] args)
-
- {
-
- try
-
- {
-
- WebClient client = new WebClient();
-
- client.Encoding = System.Text.Encoding.Default;
-
- string response = client.UploadString(“http://iframe.ip138.com/ipcity.asp”, “”);
-
- Match mc = Regex.Match(response, @“location.href=”“(.*)”“”);
-
- if (mc.Success && mc.Groups.Count > 1)
-
- {
-
- response = client.UploadString(mc.Groups[1].Value, “”);
-
- string[] str1 = response.Split('[');
-
- response = str1[1];
-
- string [] str = response.Split(']');
-
- response = str[0];
-
- Console.Write(response);
-
- }
-
- }
-
- catch (System.Exception e)
-
- {
-
- }
-
- Console.Read();
-
- }
-
- }
-
- }
复制代码 |
|