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

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

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

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

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

查看: 9679|回复: 6

[开发助手] 助手生成httphelper报未将对象引用设置到对象的实例。

[复制链接]
发表于 2015-4-15 15:22:36 | 显示全部楼层 |阅读模式
1金钱
https://login.weixin.qq.com/jslogin?appid=wx782c26e4c19acffb&redirect_uri=https%3A%2F%2Fwx.qq.com%2Fcgi-bin%2Fmmwebwx-bin%2Fwebwxnewloginpage&fun=new&lang=zh_CN&_=1365142128439  抓包地址,望大神赐教~~



1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
 楼主| 发表于 2015-4-15 15:41:41 | 显示全部楼层
基础连接已经关闭: 发送时发生错误。
回复

使用道具 举报

发表于 2015-4-15 16:02:42 | 显示全部楼层
这个说明请求时出错,参数不对。或者是Cookie不对
回复

使用道具 举报

 楼主| 发表于 2015-4-15 16:21:20 | 显示全部楼层
抓包信息:
Remote Address:101.226.76.164:443
Request URL:https://login.weixin.qq.com/jslo ... amp;_=1365142128439
Request Method:GET
Status Code:200 OK
Response Headers
view source
Cache-Control:no-cache, must-revalidate
Connection:keep-alive
Content-Encoding:deflate
Content-Length:55
Content-Type:text/javascript
Content-Type:text/html; charset=gbk
Request Headers
view source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:zh-CN,zh;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Cookie:pgv_pvi=9736324096; mm_lang=zh_CN
Host:login.weixin.qq.com
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36
Query String Parameters
view source
view URL encoded
appid:wx782c26e4c19acffb
redirect_uri:https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage
fun:new
lang:zh_CN
_:1365142128439
-------------------------------------------
后台代码:
DotNet4.Utilities.HttpHelper http = new DotNet4.Utilities.HttpHelper();
                DotNet4.Utilities.HttpItem item = new DotNet4.Utilities.HttpItem()
                {
                    URL = "https://login.weixin.qq.com/jslogin?appid=wx782c26e4c19acffb&redirect_uri=https%3A%2F%2Fwx.qq.com%2Fcgi-bin%2Fmmwebwx-bin%2Fwebwxnewloginpage&fun=new&lang=zh_CN&_=1365142128439",//URL     必需项   
                    Method = "get",//URL     可选项 默认为Get   
                    IsToLower = false,//得到的HTML代码是否转成小写     可选项默认转小写   
                    Cookie = "",//字符串Cookie     可选项   
                    Referer = "",//来源URL     可选项   
                    Postdata = "",//Post数据     可选项GET时不需要写   
                    Timeout = 100000,//连接超时时间     可选项默认为100000   
                    ReadWriteTimeout = 30000,//写入Post数据超时时间     可选项默认为30000   
                    UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36",//用户的浏览器类型,版本,操作系统     可选项有默认值   
                    ContentType = "application/x-www-form-urlencoded",//返回类型    可选项有默认值   
                    Allowautoredirect = true,//是否根据301跳转     可选项   
                    //CerPath = "d:\123.cer",//证书绝对路径     可选项不需要证书时可以不写这个参数   
                    //Connectionlimit = 1024,//最大连接数     可选项 默认为1024   
                    ProxyIp = "",//代理服务器ID     可选项 不需要代理 时可以不设置这三个参数   
                    //ProxyPwd = "123456",//代理服务器密码     可选项   
                    //ProxyUserName = "administrator",//代理服务器账户名     可选项   
                    ResultType = DotNet4.Utilities.ResultType.String
                };
                DotNet4.Utilities.HttpResult result = http.GetHtml(item);
                Response.Write(result.Html);
回复

使用道具 举报

 楼主| 发表于 2015-4-15 16:22:10 | 显示全部楼层
站长苏飞 发表于 2015-4-15 16:02
这个说明请求时出错,参数不对。或者是Cookie不对


抓包信息:
Remote Address:101.226.76.164:443
Request URL:https://login.weixin.qq.com/jslo ... amp;_=1365142128439
Request Method:GET
Status Code:200 OK
Response Headers
view source
Cache-Control:no-cache, must-revalidate
Connection:keep-alive
Content-Encoding:deflate
Content-Length:55
Content-Type:text/javascript
Content-Type:text/html; charset=gbk
Request Headers
view source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:zh-CN,zh;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Cookie:pgv_pvi=9736324096; mm_lang=zh_CN
Host:login.weixin.qq.com
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36
Query String Parameters
view source
view URL encoded
appid:wx782c26e4c19acffb
redirect_uri:https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage
fun:new
lang:zh_CN
_:1365142128439
-------------------------------------------
后台代码:
DotNet4.Utilities.HttpHelper http = new DotNet4.Utilities.HttpHelper();
                 DotNet4.Utilities.HttpItem item = new DotNet4.Utilities.HttpItem()
                 {
                     URL = "https://login.weixin.qq.com/jslogin?appid=wx782c26e4c19acffb&redirect_uri=https%3A%2F%2Fwx.qq.com%2Fcgi-bin%2Fmmwebwx-bin%2Fwebwxnewloginpage&fun=new&lang=zh_CN&_=1365142128439",//URL     必需项   
                    Method = "get",//URL     可选项 默认为Get   
                     IsToLower = false,//得到的HTML代码是否转成小写     可选项默认转小写   
                     Cookie = "",//字符串Cookie     可选项   
                     Referer = "",//来源URL     可选项   
                     Postdata = "",//Post数据     可选项GET时不需要写   
                     Timeout = 100000,//连接超时时间     可选项默认为100000   
                    ReadWriteTimeout = 30000,//写入Post数据超时时间     可选项默认为30000   
                     UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36",//用户的浏览器类型,版本,操作系统     可选项有默认值   
                     ContentType = "application/x-www-form-urlencoded",//返回类型    可选项有默认值   
                     Allowautoredirect = true,//是否根据301跳转     可选项   
                     //CerPath = "d:\123.cer",//证书绝对路径     可选项不需要证书时可以不写这个参数   
                     //Connectionlimit = 1024,//最大连接数     可选项 默认为1024   
                    ProxyIp = "",//代理服务器ID     可选项 不需要代理 时可以不设置这三个参数   
                    //ProxyPwd = "123456",//代理服务器密码     可选项   
                    //ProxyUserName = "administrator",//代理服务器账户名     可选项   
                     ResultType = DotNet4.Utilities.ResultType.String
                 };
                 DotNet4.Utilities.HttpResult result = http.GetHtml(item);
                 Response.Write(result.Html);

回复

使用道具 举报

 楼主| 发表于 2015-4-16 16:43:31 | 显示全部楼层
站长苏飞 发表于 2015-4-15 16:02
这个说明请求时出错,参数不对。或者是Cookie不对

大神帮我看看,是哪里错了吗?

                string url = "https://login.weixin.qq.com/jslogin?appid=wx782c26e4c19acffb&redirect_uri=https%3A%2F%2Fwx.qq.com%2Fcgi-bin%2Fmmwebwx-bin%2Fwebwxnewloginpage&fun=new&lang=zh_CN&_=1365142128439";
                string cookie = GetCookieString(url);
                DotNet4.Utilities.HttpHelper http = new DotNet4.Utilities.HttpHelper();
                DotNet4.Utilities.HttpItem item = new DotNet4.Utilities.HttpItem()
                {
                    URL = url,//URL     必需项
                    Method = "get",//URL     可选项 默认为Get
                    Cookie = cookie,//字符串Cookie     可选项
                    UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36",//用户的浏览器类型,版本,操作系统     可选项有默认值
                    Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",//    可选项有默认值
                    ContentType = "text/javascript;text/html; charset=gbk",//返回类型    可选项有默认值
                    Host = "login.weixin.qq.com",
                    Encoding = Encoding.GetEncoding("gbk")
                };
                //得到HTML代码
                item.Header.Add("Content-Encoding:deflate");
                item.Header.Add("Accept-Language:zh-CN,zh;q=0.8");
                item.Header.Add("Accept-Encoding:gzip, deflate, sdch");
                DotNet4.Utilities.HttpResult result = http.GetHtml(item);
                Response.Write(result.Html);

            }感激不尽。
回复

使用道具 举报

发表于 2015-4-16 17:18:27 | 显示全部楼层
微信的没做过不清楚啊。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

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

GMT+8, 2024-5-24 03:39

© 2014-2021

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