|
[code=csharp]HttpHelper http = new HttpHelper();
//第一步
HttpItem item = new HttpItem()
{
URL = "http://www.scjj.gov.cn:122/main.aspx?str=510100|%E5%B7%9DA|%E6%88%90%E9%83%BD%E5%B8%82%E5%85%AC%E5%AE%89%E5%B1%80%E4%BA%A4%E9%80%9A%E8%AD%A6%E5%AF%9F%E6%94%AF%E9%98%9F%E8%BD%A6%E8%BE%86%E7%AE%A1%E7%90%86%E6%89%80",//URL 必需项
Encoding = null,//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
//Encoding = Encoding.Default,
Method = "post",//URL 可选项 默认为Get
Timeout = 100000,//连接超时时间 可选项默认为100000
ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写
Cookie = "",//字符串Cookie 可选项
UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统 可选项有默认值
Accept = "text/html, application/xhtml+xml, */*",// 可选项有默认值
ContentType = "text/html",//返回类型 可选项有默认值
Referer = "http://www.scjj.gov.cn:122/OptFZJG.aspx",//来源URL 可选项
};
item.Postdata = "butNext=同意";
//得到HTML代码
HttpResult result = http.GetHtml(item);
//测试打印出返回的HTML
Response.Write(result.Html);
//第二步
item = new HttpItem()
{
URL = "http://www.scjj.gov.cn:122/FormPlateNoSelect.aspx",//URL 必需项
Encoding = null,//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
//Encoding = Encoding.Default,
Method = "post",//URL 可选项 默认为Get
Timeout = 100000,//连接超时时间 可选项默认为100000
ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写
UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统 可选项有默认值
Accept = "text/html, application/xhtml+xml, */*",// 可选项有默认值
ContentType = "text/html",//返回类型 可选项有默认值
Cookie = result.Cookie,//当前登录Cookie
Referer = "http://www.scjj.gov.cn:122/main.aspx",//来源URL 可选项
};
item.Postdata = "butNewVehPlateNO=小型汽车注册登记自主编号&__EVENTVALIDATION=/wEWBAKX4rj4AgLh0djlDALb+7L6AgLUg5HPAYVwvOqKIftd8EPKk0hftauCkCLZ&__VIEWSTATE=/wEPDwUJMTI0Nzk4MjA1D2QWAgIDD2QWAgIDDw8WAh4EVGV4dAUz5oiQ6YO95biC5YWs5a6J5bGA5Lqk6YCa6K2m5a+f5pSv6Zif6L2m6L6G566h55CG5omAZGRkyz0pgoNXe1U6K3+Pqz9HkpYw4ZM=";
//得到HTML代码
result = http.GetHtml(item);
////测试打印出返回的HTML
Response.Write(result.Html);
//第三步
item = new HttpItem()
{
URL = "http://www.scjj.gov.cn:122/selSlrq.aspx",//URL 必需项
Encoding = null,//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
//Encoding = Encoding.Default,
Method = "get",//URL 可选项 默认为Get
Timeout = 100000,//连接超时时间 可选项默认为100000
ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写
UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统 可选项有默认值
Accept = "text/html, application/xhtml+xml, */*",// 可选项有默认值
ContentType = "text/html",//返回类型 可选项有默认值
Cookie = result.Cookie,//当前登录Cookie
Referer = "http://www.scjj.gov.cn:122/FormPlateNoSelect.aspx",//来源URL 可选项
};
//得到HTML代码
result = http.GetHtml(item);
//测试打印出返回的HTML
Response.Write(result.Html);
//第四步
item = new HttpItem()
{
URL = "http://www.scjj.gov.cn:122/selSlrq_510100.aspx",//URL 必需项
Encoding = null,//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
//Encoding = Encoding.Default,
Method = "post",//URL 可选项 默认为Get
Timeout = 100000,//连接超时时间 可选项默认为100000
ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写
UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统 可选项有默认值
Accept = "text/html, application/xhtml+xml, */*",// 可选项有默认值
ContentType = "text/html",//返回类型 可选项有默认值
Cookie = result.Cookie,//当前登录Cookie
Referer = "http://www.scjj.gov.cn:122/selSlrq.aspx",//来源URL 可选项
};
item.Postdata = "tbClxhNJ7180ZT=&tbCjh=LNPA7PBD89G040062&butSelect=查询&__EVENTVALIDATION= /wEWBQKq3cn3AwK1/p+mAwLF/tfsAQL0kIMeAtSDkc8BvZ6zJM0iQUb+koJfWj+C82bKnFM=&__VIEWSTATE=/wEPDwULLTE1NjMwOTAzNDQPZBYCAgMPZBYEAgMPDxYCHgRUZXh0BTPmiJDpg73luILlhazlronlsYDkuqTpgJrorablr5/mlK/pmJ/ovabovobnrqHnkIbmiYBkZAIFDw8WAh8ABdwC5b2T5YmN5Y+v6Ieq57yW5Y+35q615Li677yaPGZvbnQgY29sb3I9I2ZmMzMwMz7lt51Bw5fDl8OXw5fDlzwvZm9udD7vvIh46KGo56S65pWw5a2X5oiW5a2X5q+N77yJ44CCPGJyIC8+5o+Q56S677ya55Sx5LqO5Y+v5L6b6YCJ5oup55qE5pWw5a2X5ZKM5a2X5q+N55qE57uE5ZCI5pa55byP5aKe5aSa77yM6L2m5Li75Y+v5Zyo4oCceHh4eHjigJ3pg6jliIbnmoTku7vmhI/kvY3nva7kuIrvvIznoa7lrprkuKTkvY3lj4rku6XkuIrnmoTmlbDlrZfmiJblrZfmr43vvIzljbPlj6/lj5blj7fniYzjgII8YnIgLz7lj7fniYzmsaDliankvZk8Zm9udCBjb2xvcj0jZmYzMzAzPjI0ODI0NzwvZm9udD7lia/lj7fniYwhZGRkRhdMptN3oFYZ75k3DC5NeQJWSoo=";
//得到HTML代码
result = http.GetHtml(item);
//string html = result.Html;
//string cookie = result.Cookie.ToString();
//测试打印出返回的HTML
Response.Write(result.Html);
//第五步
item = new HttpItem()
{
URL = "http://www.scjj.gov.cn:122/selSlrq_510100_1.aspx",//URL 必需项
Encoding = null,//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
//Encoding = Encoding.Default,
Method = "get",//URL 可选项 默认为Get
Timeout = 100000,//连接超时时间 可选项默认为100000
ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写
UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",//用户的浏览器类型,版本,操作系统 可选项有默认值
Accept = "text/html, application/xhtml+xml, */*",// 可选项有默认值
ContentType = "text/html",//返回类型 可选项有默认值
Cookie = result.Cookie,//当前登录Cookie
Referer = "http://www.scjj.gov.cn:122/selSlrq_510100.aspx",//来源URL 可选项
};
//得到HTML代码
result = http.GetHtml(item);
//测试打印出返回的HTML
Response.Write(result.Html);[/code]
请各位大神帮忙看一下,前两步都得到正常的返回值。最后三步得到结果是:
Object moved to here.
Object moved to here.
Object moved to here.
|
|