http://www.sufeinet.com/plugin.php?id=keke_group

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程

HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成

HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子

查看: 4262|回复: 5

[其他] 模拟网站签到问题

[复制链接]
发表于 2014-1-10 11:31:25 | 显示全部楼层 |阅读模式
我对网站的签到截包的时候获取到
[C#] 纯文本查看 复制代码
GET /plugin.php?id=fx_checkin:checkin&formhash=d6587180&d6587180&infloat=yes&handlekey=fx_checkin&inajax=1&ajaxtarget=fwin_content_fx_checkin HTTP/1.1
Host: [url]www.unitymanual.com[/url]
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:25.0) Gecko/20100101 Firefox/25.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
X-Requested-With: XMLHttpRequest
Referer: [url]http://www.unitymanual.com/[/url]
Cookie: bdshare_firstime=1381110987077; 8ZMk_2132_ulastactivity=2578pG6OyYlUcJkqGp9YfbY1JDWAbCPRk7KxKgC6HLxWaBYG5tH6; 8ZMk_2132_connect_uin=97DF0465BC349C566738377E5F86607F; 8ZMk_2132_visitedfid=75D63D100D97D96D62D53D40D47; 8ZMk_2132_smile=1D1; CNZZDATA4924487=cnzz_eid%3D421972497-1383789400-http%253A%252F%252Fwww.unitymanual.com%26ntime%3D1389316235%26cnzz_a%3D0%26ltime%3D1389316233025%26rtime%3D25; 8ZMk_2132_connect_is_bind=1; 8ZMk_2132_auth=5e00iEkyxULrb1%2FftvqtQUbbNVl1wsGe4h3X2k8XaQHGY0coW6AlieXevzj1V03ZGnu3Q4N7kWjpVj%2FNJNO1eXRj; 8ZMk_2132_saltkey=sQyjd3JU; 8ZMk_2132_lastvisit=1386720851; 8ZMk_2132_lastcheckfeed=5157%7C1386724474; 8ZMk_2132_atarget=1; 8ZMk_2132_nofavfid=1; 8ZMk_2132_sid=jPuJt3; 8ZMk_2132_lip=112.94.150.36%2C1389230039; 8ZMk_2132_lastact=1389316237%09misc.php%09patch; 8ZMk_2132_connect_last_report_time=2014-01-10; 8ZMk_2132_sendmail=1; tjpctrl=1389318043604
Connection: keep-alive


然后自己模拟的时候
[C#] 纯文本查看 复制代码
//string loginUrl = "http://www.unitymanual.com/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1";登录的url
//fastloginfield=username&username=登录名&password=密码&quickforward=yes&handlekey=ls  登录的postdata
                        HttpHelper2 http = new HttpHelper2();
                        HttpItem item = new HttpItem()
                        {
                            URL = "http://www.unitymanual.com/",//URL     必需项   
                            Encoding = System.Text.Encoding.GetEncoding("gbk"),//URL     可选项 默认为Get   
                            Method = "get",//URL     可选项 默认为Get   
                            Cookie = "",//字符串Cookie     可选项     
                            UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",/
                            ContentType = "text/html",//返回类型    可选项有默认值   
                        };
                        result = http.GetHtml(item);
                        formhash = Regex.Match(result.Html, @"(?<=formhash=)\w+").Value;//获取formhash

                        string url = "http://www.unitymanual.com/plugin.php?id=fx_checkin:checkin&formhash=" +formhash+"&"+ formhash + "&infloat=yes&handlekey=fx_checkin&inajax=1&ajaxtarget=fwin_content_fx_checkin";
                        HttpItem item2 = new HttpItem()
                        {
                            URL = url,//URL     必需项   
                            Method = "get",//URL     可选项 默认为Get   
                            Cookie = result.Cookie,//字符串Cookie     可选项     
                            UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",/
                            ContentType = "text/html",//返回类型    可选项有默认值   
                            Referer = "http://www.unitymanual.com/",
                            KeepAlive = true
                        };
                        result = http.GetHtml(item2);//签到

但是在result.html返回的是没有数据,网站上显示也是没有签到的,请问这是什么原因?



1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
发表于 2014-1-10 11:33:54 | 显示全部楼层
把ContentType换成application/x-www-form-urlencoded
 楼主| 发表于 2014-1-10 11:42:06 | 显示全部楼层
本帖最后由 依默 于 2014-1-10 11:44 编辑
站长苏飞 发表于 2014-1-10 11:33
把ContentType换成application/x-www-form-urlencoded

result.html 还是 “本次请求并未返回任何数据”
2014-01-10_114241.png
发表于 2014-1-10 11:43:47 | 显示全部楼层
你调试看看传的值对不对,然后再和包对比下吧。一般情况下都是参数问题
 楼主| 发表于 2014-1-10 11:46:31 | 显示全部楼层
[C#] 纯文本查看 复制代码
这个是我自己get的时候的截包
GET /plugin.php?id=fx_checkin:checkin&formhash=425d0d9e&425d0d9e&infloat=yes&handlekey=fx_checkin&inajax=1&ajaxtarget=fwin_content_fx_checkin HTTP/1.1
Host: [url]www.unitymanual.com[/url]
ccept: text/html, application/xhtml+xml, */*
Content-Type: text/html
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
Cookie: 
8ZMk_2132_saltkey=C4FcAlTA; expires=Sun, 09-Feb-2014 03:08:56 GMT; path=/; httponly,8ZMk_2132_lastvisit=1389319736; expires=Sun, 09-Feb-2014 03:08:56 GMT; path=/,8ZMk_2132_sid=jJp88p; expires=Sat, 11-Jan-2014 03:08:56 GMT; path=/,8ZMk_2132_lastact=1389323336%09index.php%09; expires=Sat, 11-Jan-2014 03:08:56 GMT; path=/,8ZMk_2132_sid=jJp88p; expires=Sat, 11-Jan-2014 03:08:56 GMT; path=/
Referer: [url]http://www.unitymanual.com/[/url]
Connection: Keep-Alive
下面这个是网站登录的截包,
感觉差了几个,但是应该没什么影响的吧
GET /plugin.php?id=fx_checkin:checkin&formhash=d6587180&d6587180&infloat=yes&handlekey=fx_checkin&inajax=1&ajaxtarget=fwin_content_fx_checkin HTTP/1.1
Host: [url]www.unitymanual.com[/url]
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:25.0) Gecko/20100101 Firefox/25.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
X-Requested-With: XMLHttpRequest
Referer: [url]http://www.unitymanual.com/[/url]
Cookie: bdshare_firstime=1381110987077; 8ZMk_2132_ulastactivity=2578pG6OyYlUcJkqGp9YfbY1JDWAbCPRk7KxKgC6HLxWaBYG5tH6; 8ZMk_2132_connect_uin=97DF0465BC349C566738377E5F86607F; 8ZMk_2132_visitedfid=75D63D100D97D96D62D53D40D47; 8ZMk_2132_smile=1D1; CNZZDATA4924487=cnzz_eid%3D421972497-1383789400-http%253A%252F%252Fwww.unitymanual.com%26ntime%3D1389316235%26cnzz_a%3D0%26ltime%3D1389316233025%26rtime%3D25; 8ZMk_2132_connect_is_bind=1; 8ZMk_2132_auth=5e00iEkyxULrb1%2FftvqtQUbbNVl1wsGe4h3X2k8XaQHGY0coW6AlieXevzj1V03ZGnu3Q4N7kWjpVj%2FNJNO1eXRj; 8ZMk_2132_saltkey=sQyjd3JU; 8ZMk_2132_lastvisit=1386720851; 8ZMk_2132_lastcheckfeed=5157%7C1386724474; 8ZMk_2132_atarget=1; 8ZMk_2132_nofavfid=1; 8ZMk_2132_sid=jPuJt3; 8ZMk_2132_lip=112.94.150.36%2C1389230039; 8ZMk_2132_lastact=1389316237%09misc.php%09patch; 8ZMk_2132_connect_last_report_time=2014-01-10; 8ZMk_2132_sendmail=1; tjpctrl=1389318043604
Connection: keep-alive
发表于 2014-1-10 11:49:10 | 显示全部楼层
不要用字符串Cookie试试http://www.sufeinet.com/thread-6015-1-1.html参考这里
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)

GMT+8, 2024-11-23 20:42

© 2014-2021

快速回复 返回顶部 返回列表