http://yunvs.com/index.php?m=member&siteid=1
用户名dxwang
密码qw123123
代码如下
[C#] 纯文本查看 复制代码 //string url = textBox1.Text;
HttpHelper http = new HttpHelper();
//创建Httphelper参数对象
HttpItem item = new HttpItem()
{
URL = "http://yunvs.com/index.php?m=member&c=index&a=login&forward=http%3A%2F%2Fyunvs.com%2Findex.php%3Fm%3Dmember%26c%3Dindex",
Referer = "http://yunvs.com/index.php?m=member&c=index",
Host = "yunvs.com",
Postdata ="forward=http%253A%252F%252Fyunvs.com%252Findex.php%253Fm%253Dmember%2526c%253Dindex&username=dxwang&password=qw123123&cookietime=2592000&dosubmit=%B5%C7%C2%BC",// string.Format("method=login&uid={0}&pwdtype=&hardInfo=&logintype=common&flowno=&usbkeySn=&usbkeyData=&mac=>ja_dating_login_type=0&availHeight=958&YYBFW=10&BranchCode=3119&BranchName=上海威海路证券营业部&Page=&selectBranchCode=7001&countType=Z&inputid={1}&trdpwd={3}&AppendCode={2}", "520223", "7385", textBox13.Text, GetPass("520223"))
ContentType = "application/x-www-form-urlencoded",
UserAgent="Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0",
ResultCookieType = ResultCookieType.CookieCollection
};
//item.Header.Add("X-Prototype-Version: 1.5.0_rc1");
//item.Header.Add("X-Requested-With: XMLHttpRequest");
//请求的返回值对象
HttpResult result = http.GetHtml(item);
//获取请求的Cookie
CookieCollection cookie = result.CookieCollection;
// 第二次使用Cookie
//创建Httphelper参数对象
item = new HttpItem()
{
URL = "http://yunvs.com/index.php?m=member&c=index",
Referer = "http://yunvs.com/index.php?m=member&c=index",
Host = "yunvs.com",
Method = "get",
PostEncoding = Encoding.Default,
CookieCollection = cookie,//把Cookie写入请求串中
ResultCookieType = ResultCookieType.CookieCollection,
};
//请求的返回值对象
result = http.GetHtml(item);
//获取Html
string html = result.Html;
textBox2.Text = html;
为什么不行,高手给看看
|