联通营业厅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; } }

 

转载于:https://www.cnblogs.com/myshowtime/p/6282451.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值