- 积分
- 40165
- 好友
- 记录
- 主题
- 帖子
- 听众
- 收听
|
发表于 2013-6-3 10:41:42
|
显示全部楼层
[code=csharp]
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "http://www.loveq.cn/user.php",//URL 必需项
Method = "POST",//URL 可选项 默认为Get
Timeout = 100000,//连接超时时间 可选项默认为100000
ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写
Referer = "http://www.loveq.cn/user-default.html",
ContentType = "application/x-www-form-urlencoded",//返回类型 可选项有默认值
Postdata = "username=test00001&password=test00001&act=act_login&back_act=user.php%3Fact%3Ddefault",//Post数据 可选项GET时不需要写
//Allowautoredirect = false
};
HttpResult result = http.GetHtml(item);
//登录成功后进行添加好友操作
item = new HttpItem()
{
URL = "http://www.loveq.cn/friend.php",//URL
Method = "POST",//URL 可选项 默认为Get
Cookie = result.Cookie,//当前登录Cookie
Postdata = "act=add&uid=1035182&is_ajax=1", //POST出去的数据,添加好友,httpwatch抓取,不知道对不对?
ContentType = "application/x-www-form-urlencoded",
Referer = "http://www.loveq.cn/user_list.php?sex=1&age[0]=&age[1]=&height[0]=&height[1]=&weight[0]=&weight[1]=&residence[c]=1&residence[p]=0&residence[t]=0&residence[d]=0&photo=0&order=post&act=act_search&fromact=quick"
};
item.Cookie = item.Cookie.Replace("path=/;","");
item.Header.Add("X-Requested-With", "XMLHttpRequest");
item.Header.Add("Powered-By", "Ican Cheung");
result = http.GetHtml(item);
string html = result.Html;[/code]
|
|