• 联通营业厅API 获取个人信息


    联通营业厅API 获取个人信息

     
    复制代码
                    string newValue = base.Request["tel"];
                    string newValue2 = base.Request["pwd"];
                    string postUrl = "https://uac.10010.com/portal/Service/MallLogin";
                    string text = "callback=jQuery17204603273952720519_1482133308884&req_time=1482133346899&redirectURL=http%3A%2F%2Fwww.10010.com&userName=@tel&password=@pwd&pwdType=01&productType=01&redirectType=03&
    rememberMe=1&_=1482133346900"; text = text.Replace("@tel", newValue).Replace("@pwd", newValue2); CookieContainer cookie = WebClientHelper.GetCookie(text, postUrl); string content = WebClientHelper.GetContent(cookie, "https://uac.10010.com/cust/infomgr/anonymousInfoAJAX"); base.Response.Write(content);

    复制代码
    复制代码



    public static class WebClientHelper { public static CookieContainer GetCookie(string postString, string postUrl) { CookieContainer cookieContainer = new CookieContainer(); HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(postUrl); httpWebRequest.CookieContainer = cookieContainer; httpWebRequest.Method = "POST"; httpWebRequest.KeepAlive = true; httpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko"; httpWebRequest.Accept = "text/html, application/xhtml+xml, */*"; httpWebRequest.ContentType = "application/x-www-form-urlencoded"; byte[] bytes = Encoding.UTF8.GetBytes(postString); httpWebRequest.ContentLength = (long)bytes.Length; Stream requestStream = httpWebRequest.GetRequestStream(); requestStream.Write(bytes, 0, bytes.Length); requestStream.Close(); HttpWebResponse arg_85_0 = (HttpWebResponse)httpWebRequest.GetResponse(); return cookieContainer; } public static string GetContent(CookieContainer cookie, string url) { HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url); httpWebRequest.CookieContainer = cookie; httpWebRequest.Referer = url; httpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko"; httpWebRequest.Accept = "text/html, application/xhtml+xml, */*"; httpWebRequest.ContentType = "application/x-www-form-urlencoded"; httpWebRequest.Method = "GET"; HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); string result; using (Stream responseStream = httpWebResponse.GetResponseStream()) { using (StreamReader streamReader = new StreamReader(responseStream, Encoding.UTF8)) { result = streamReader.ReadToEnd(); } } return result; } }
    复制代码
  • 相关阅读:
    在springboot程序中自定义注解和反序列化实现
    文章相似度算法调研
    HTTP协议详解
    prototype.js 让你更深入的了解javascript的面向对象特性(转)
    ajax框架汇总
    prototype源码分析(转)
    c#中静态成员和实例成员(转)
    .NET中IDisposable接口的基本使用 (转)
    sql server 数据库优化(转)
    ADO.NET事物
  • 原文地址:https://www.cnblogs.com/sexintercourse/p/16344165.html
Copyright © 2020-2023  润新知