BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / www-technology / #13611同步于 2011/5/27
该镜像源已超过 30 天没有更新,可能在源站已被删除。
WWWTechnology机器人发帖

麻烦大家帮我指点下。如何模拟登录百度

sunlujing
2011/5/27镜像同步8 回复
我想写个程序模拟登录百度,分析我文库每天的得分等情况。(我上次发过贴),我现在用的是httpClient,登录人人行了,发现百度 用的是 https,一直登不上,谁模拟登录过https协议网站的。。给个大致的流程,先谢过。问题是木有相应, The target server failed to respond。
订阅后,新回复会通过你的通知中心匿名送达。
8 条回复
chucai机器人#1 · 2011/5/27
没有做过,帮顶!
zzcc机器人#2 · 2011/5/27
httpClient支持https协议啊 http://topic.csdn.net/u/20100716/14/b4e9a5b8-50ba-4355-9e84-c71319779776.html 估计能解决你的问题 baidu 做了refer限制吧
sunlujing机器人#3 · 2011/5/27
【 在 zzcc 的大作中提到: 】 : httpClient支持https协议啊 : http://topic.csdn.net/u/20100716/14/b4e9a5b8-50ba-4355-9e84-c71319779776.html : 估计能解决你的问题 : ................... 这个我试了。登不上。。refer现在是啥啊。。
zzcc机器人#4 · 2011/5/27
抓个包看看? 【 在 sunlujing 的大作中提到: 】 : : httpClient支持https协议啊 : : http://topic.csdn.net/u/20100716/14/b4e9a5b8-50ba-4355-9e84-c71319779776.html : : 估计能解决你的问题 : ...................
sunlujing机器人#5 · 2011/5/28
【 在 zzcc 的大作中提到: 】 : 抓个包看看? : 【 在 sunlujing 的大作中提到: 】 : : : httpClient支持https协议啊 : ................. 我抓包试了试,按照整个过程模拟了一下。还是不行。。你帮我模拟登上去吧。我请你去东门吃干锅鸭头啊。
zzcc机器人#6 · 2011/5/29
回头python试试吧
zzcc机器人#7 · 2011/6/1
登录无任何问题啊?python代码,用以前的改的 BANGUMI_LOGIN_POSTTO = "https://passport.baidu.com/?login" class bangumi_api: def __init__(self, username, password): self.username = username self.password = password self.logined = False def login(self): form_data = { 'tpl_ok':'', 'next_target':'', 'tpl':'', 'skip_ok':'', 'aid':'', 'need_pay':'', 'need_coin':'', 'pay_method':'', 'u':'http://passport.baidu.com/center', 'return_method':'get', 'more_param':'', 'return_type':'', 'psp_tt':'0', 'password':self.password, 'safeflg':'0', 'isphone':'false', 'username':self.username, 'verifycode':'', 'mem_pass':'on'} req = urllib2.Request(BANGUMI_LOGIN_POSTTO, data=urlencode(form_data)) req.add_header('Referer', BANGUMI_LOGIN) req.add_header('User-Agent', USER_AGENT) response = urllib2.urlopen(req) 返回头部和content================================= Set-Cookie: BAIDUID=D9BXXXXXXXXXXXXXXXXXXXXXXXX6:FG=1; max-age=946080000; ex pires=Fri, 24-May-41 05:48:22 GMT; domain=.baidu.com; path=/; version=1 P3P: CP=" OTI DSP COR IVA OUR IND COM " Date: Wed, 01 Jun 2011 05:48:22 GMT Server: Apache P3P: CP=" OTI DSP COR IVA OUR IND COM " P3P: CP=" OTI DSP COR IVA OUR IND COM " P3P: CP=" OTI DSP COR IVA OUR IND COM " Set-Cookie: BAIDUID=EXXXXXXXXXXXXXXXXXXXXXXXC:FG=1; expires=Fri, 24-May-4 1 05:48:22 GMT; max-age=946080000; path=/; domain=.baidu.com; version=1 Set-Cookie: BAIDUID=EXXXXXXXXXXXXXXXXXXXXXXXXXXXX3:FG=1; expires=Fri, 24-May-4 1 05:48:22 GMT; max-age=946080000; path=/; domain=.baidu.com; version=1 Set-Cookie: BDUSS=Ux-clVlYlZhUUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1YdzF PQVFBQUFBJCQAAAAAAAAAAApBESMx-JoAYmludXgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgKiV 1AAAAAOAqJXUAAAAAcF1CAAAAAAAxMC42NS4yNKbS5U2m0uVNd; expires=Tue, 01 Jan 2030 00: 00:00 GMT; path=/; domain=.baidu.com Set-Cookie: PTOKEN=12XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXac; expires=Tue, 01 Jan 2030 00 :00:00 GMT; path=/; domain=passport.baidu.com; HttpOnly Set-Cookie: STOKEN=b4XXXXXXXXXXXXXXXXXXXXXXXXXXXc1; expires=Tue, 01 Jan 2030 00 :00:00 GMT; path=/; domain=passport.baidu.com Set-Cookie: USERID=339XXXXXXXXXXXc; expires=Tue, 01 Jan 2030 00:00:00 GMT; pa th=/; domain=.baidu.com Content-Type: text/html;charset=gbk Cache-Control: no-cache Pragma: no-cache Content-Encoding: none Content-Length: 389 Connection: close <!--STATUS OK--> <html><head><title>用户登录 </title> <meta http-equiv=content-type content="text/html; charset=gb2312"> <META http-equiv='Pragma' content='no-cache'> </head> <body> <script> var url="http://passport.baidu.com/center" url=url.replace(/^\.\//gi,"http://passport.baidu.com/"); location.href=url; </script> </body> </html> 【 在 zzcc 的大作中提到: 】 : 回头python试试吧 : --
xuxing114机器人#8 · 2011/6/5
顶!