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

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

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

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

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

查看: 44561|回复: 2

[HttpHelper] 通过https://signup.live.com/signup这个地址验证邮箱是否有效,但是老报错

[复制链接]
发表于 2015-12-29 17:50:24 | 显示全部楼层 |阅读模式
不多说了直接上代码:
[C#] 纯文本查看 复制代码
public static string checkHotmail(string mail) {            //1.取cookie
            string hotmailCookie = "";
            HttpHelper http = new HttpHelper();
            HttpItem item = new HttpItem()
            {
                URL = "https://signup.live.com/signup",
                Method = "get",

            };
            HttpResult result = http.GetHtml(item);
            string uaid = "";
            string location = "";
            //返回的Html内容
            hotmailCookie = result.Cookie;
            uaid = getCenerString(location, "uaid%3D", "%26lic");
             item = new HttpItem()
            {
                URL = location,
                Method = "get",
                Cookie = hotmailCookie,
                Allowautoredirect = true,//是否根据301跳转     可选项
            };
            result = http.GetHtml(item);
            //返回的Html内容
            if (result.StatusCode == System.Net.HttpStatusCode.OK)
            {
                //Console.WriteLine("cookie2:" + result.Cookie);
                hotmailCookie = hotmailCookie + "," + result.Cookie;
            }
            else {
                return "";
            }

            item = new HttpItem()
            {
                URL = "https://signup.live.com/API/CheckAvailableSigninNames",
                Method = "POST",//URL     可选项 默认为Get
                Postdata = "{\"signInName\":\"jxfgoodboy@outlook.com\",\"isEasiCheck\":false,\"uaid\":\"" + uaid + "\",\"uiflvr\":1001,\"scid\":100118,\"hpgid\":200225}",
                Referer = "https://signup.live.com/signup.aspx?uaid=" + uaid + "&lic=1",
                ContentType = "application/x-www-form-urlencoded; charset=UTF-8",
                Cookie = hotmailCookie,
            };
            result = http.GetHtml(item);
            //返回的Html内容
            if (result.StatusCode == System.Net.HttpStatusCode.OK)
            {
                Console.WriteLine(mail + "==》:" + result.Html);
            }
            else
            {
                return "无效:取Cookie失败";
            }
            return "";
        }
        private static string getCenerString(string str, string first, string end)
        {
            Regex rg = new Regex("(?<=(" + first + "))[.\\s\\S]*?(?=(" + end + "))", RegexOptions.Multiline | RegexOptions.Singleline);
            return rg.Match(str).Value;
        }



最后返回的结果:
[C#] 纯文本查看 复制代码
{"error":{"code":"6001","data":"","showError":true,"stackTrace":""}}

难道是HttpHelper对https支持不好?望大神指点一下。




1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
发表于 2015-12-29 17:59:07 | 显示全部楼层
看看协议头,cookie跟抓包对比下
 楼主| 发表于 2015-12-29 18:03:33 | 显示全部楼层
都对上了,还是不行
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

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

GMT+8, 2024-11-25 14:14

© 2014-2021

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