zoukankan      html  css  js  c++  java
  • 联通营业厅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; } }
  • 相关阅读:
    flutter学习笔记一 基础
    android studio创建flutter 项目卡住,一直在创建。 命令行新建flutter项目
    flutter项目运行之 a problem occurred evaluating project ':app'. Could not resolve all artifacts for configuration 'classpath'. Could not find com.android.tools.build:gradle:3.5.0.
    Flutter环境搭建 之 Android license status unknown
    团队作业-第五周-运行及总结
    团队作业-第五周-测试与调试
    团队作业-第四周-面向对象程序设计
    团队作业-第三周-设计类图
    团队作业-第二周-SRS文档
    团队作业-第二周-测试计划
  • 原文地址:https://www.cnblogs.com/myshowtime/p/6282451.html
Copyright © 2011-2022 走看看