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

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

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

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

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

查看: 4085|回复: 5

[求助] HttpHelper百度联盟登入有没有成功的?

[复制链接]
发表于 2013-10-17 14:03:41 | 显示全部楼层 |阅读模式
HttpHelper百度联盟登入有没有成功的?我老是登入不上
  1.     public partial class Form1 : Form
  2.     {
  3.         public Form1()
  4.         {
  5.             InitializeComponent();

  6.         }
  7.         private void button4_Click(object sender, EventArgs e)
  8.         {
  9.             HttpHelper http = new HttpHelper();
  10.             HttpItem item = new HttpItem()
  11.             {
  12.                 URL = "http://cas.baidu.com/?action=image",//URL     必需项   
  13.                 Referer = "http://union.baidu.com/customerLogin.html?fromu=http%3A%2F%2Funion.baidu.com%2F",//来源URL     可选项   
  14.                 UserAgent = "User-Agent:Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.202 Safari/535.1",//用户的浏览器类型,版本,操作系统     可选项有默认值  
  15.                 ResultType = ResultType.Byte
  16.             };
  17.             HttpResult result = http.GetHtml(item);
  18.             code_cookie = result.Cookie;
  19.             pictureBox1.Image = byteArrayToImage(result.ResultByte);
  20.         }
  21.         string code_cookie;
  22.         private Image byteArrayToImage(byte[] Bytes)
  23.         {
  24.             MemoryStream ms = new MemoryStream(Bytes);
  25.             Image outputImg = Image.FromStream(ms);
  26.             return outputImg;
  27.         }
  28.         private void button7_Click(object sender, EventArgs e)
  29.         {
  30.             HttpHelper http = new HttpHelper();
  31.             string fr_gdcode = textBox1.Text.Trim();
  32.             HttpItem item = new HttpItem()
  33.             {
  34.                 URL = "http://cas.baidu.com/?action=login",//URL     必需项   
  35.                 Method = "post",//URL     可选项 默认为Get      
  36.                 Referer = "http://union.baidu.com/customerLogin.html?fromu=http%3A%2F%2Funion.baidu.com%2F",//来源URL     可选项   
  37.                 UserAgent = "User-Agent:Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.202 Safari/535.1",//用户的浏览器类型,版本,操作系统     可选项有默认值  
  38.                 Postdata = "entered_login="+textBox3.Text+"&entered_password="+textBox4.Text+"&sid=&pwd=&entered_imagecode=" + fr_gdcode + "&appid=6&fromu=http%253A%252F%252Funion.baidu.com%252Fuserlogin.action&selfu=&senderr=1&login2=%E7%99%BB%E5%BD%95",//Post数据     可选项GET时不需要写   
  39.                 Accept = "application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, */*",//    可选项有默认值   
  40.                 ContentType = "application/x-www-form-urlencoded",
  41.                 Allowautoredirect = false,//是否根据301跳转     可选项
  42.                 Cookie = code_cookie.Replace("path=/,", "").Replace("path=/", "")
  43.             };
  44.             HttpResult result = http.GetHtml(item);
  45.             string cookie = item.Cookie;
  46.             //这里要再次New一个,否则最少也应该修改一下Method,要不然还是继承上面的Post方式
  47.             item = new HttpItem()
  48.             {
  49.                 URL = "http://union.baidu.com/client/#/account/overview",//URL     必需项   
  50.                 Method = "get",//URL     可选项 默认为Get      
  51.                 Referer = "http://union.baidu.com/client/#/",//来源URL     可选项   
  52.                 Cookie = cookie
  53.             };
  54.             result = http.GetHtml(item);
  55.             string html = result.Html;
  56.             textBox2.Text = cookie;
  57.         }
  58.     }
复制代码


1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
发表于 2013-10-17 16:01:48 | 显示全部楼层
没号没法试。
发表于 2013-10-17 16:05:04 | 显示全部楼层

账户 可以随时注册的,
很简单,只是这个有安全控件,这个加密算法基本是破解的希望不大
 楼主| 发表于 2013-10-21 10:56:47 | 显示全部楼层
站长苏飞 发表于 2013-10-17 16:05
账户 可以随时注册的,
很简单,只是这个有安全控件,这个加密算法基本是破解的希望不大

羡慕有个用delphi 搞定了
发表于 2013-12-3 22:07:07 | 显示全部楼层
站长苏飞 发表于 2013-10-17 16:05
账户 可以随时注册的,
很简单,只是这个有安全控件,这个加密算法基本是破解的希望不大

登录地方可以选择不加载安全控件
发表于 2013-12-3 22:11:43 | 显示全部楼层
站长苏飞 发表于 2013-10-17 16:05
账户 可以随时注册的,
很简单,只是这个有安全控件,这个加密算法基本是破解的希望不大

登录地方可以选择不加载安全控件
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

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

GMT+8, 2024-5-8 20:02

© 2014-2021

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