|
楼主 |
发表于 2015-2-12 16:21:37
|
显示全部楼层
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CsharpHttpHelper;
namespace post
{
class Program
{
static void Main(string[] args)
{
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "http://user.ynshangji.com/viplogin.jsp",
Method = "post",
Postdata = "beforUrl=&cookie_value=aoruide1&userpass=aoruide1234",
Accept = "text/html, application/xhtml+xml, */*",
Referer = "http://user.ynshangji.com/vip.html",
UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)",
ContentType = "application/x-www-form-urlencoded",
Host = "user.ynshangji.com",
Connectionlimit = 2014,
};
item.Encoding = Encoding.GetEncoding("gb2312");
HttpResult result = http.GetHtml(item);
string cookie = result.Cookie;
HttpItem item1 = new HttpItem()
{
URL = "http://user.ynshangji.com/user/user_edit1.asp?userno=412634&usercode=aoruide1&userflag=1",//URL 必需项
Method = "get",//URL 可选项 默认为Get
ContentType = "text/html",//返回类型 可选项有默认值
Cookie=cookie,
//ContentType = "application/x-www-form-urlencoded",//返回类型 可选项有默认值
};
//请求的返回值对象
HttpResult result1 = http.GetHtml(item);
//获取请请求的Html
string html1 = result.Html;
//获取请求的Cookie
string cookie1 = result.Cookie;
Console.WriteLine(html1);
}
}
}
|
|