public Stream getContect() { try { Console.WriteLine("Get contect: " + Thread.CurrentThread.ManagedThreadId); HttpWebResponse response = getRequest("https://ui.ptlogin2.qq.com/cgi-bin/login?daid=164&target=self&style=16&mibao_css=m_webqq&appid=501004106&enable_qlogin=0&no_verifyimg=1&s_url=http%3A%2F%2Fw.qq.com%2Fproxy.html&f_url=loginerroralert&strong_login=1&login_state=10&t=20131024001").GetResponse() as HttpWebResponse; Stream picStream = getPic("https://ssl.ptlogin2.qq.com/ptqrshow?appid=501004106&e=2&l=M&s=3&d=72&v=4&t=0.6250925222411752&daid=164&pt_3rd_aid=0");//show it string sig = cc.GetCookies(new Uri("https://ssl.ptlogin2.qq.com/ptqrshow?appid=501004106&e=2&l=M&s=3&d=72&v=4&t=0.6250925222411752&daid=164&pt_3rd_aid=0"))["qrsig"].Value; string check = "https://ssl.ptlogin2.qq.com/ptqrlogin?ptqrtoken={0}&webqq_type=10&remember_uin=1&login2qq=1&aid=501004106&u1=http%3A%2F%2Fw.qq.com%2Fproxy.html%3Flogin2qq%3D1%26webqq_type%3D10&ptredirect=0&ptlang=2052&daid=164&from_ui=1&pttype=1&dumy=&fp=loginerroralert&action=0-0-32750&mibao_css=m_webqq&t=undefined&g=1&js_type=0&js_ver=10197&login_sig=&pt_randsalt=0"; string real = string.Format(check, Time33(sig)); smallrequest waitlogin = new smallrequest(waitLogin); waitlogin.BeginInvoke(new string[] { real }, new AsyncCallback(endLogin), waitlogin); Console.WriteLine("Start Login..."); return(picStream); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(null); }
void endLogin(IAsyncResult res) { Console.WriteLine("endLogin : "******"res"); } smallrequest d1 = res.AsyncState as smallrequest; string nexturl = d1.EndInvoke(res); HttpWebResponse response = getRequest(nexturl).GetResponse() as HttpWebResponse; HttpWebRequest vfrequest = getRequest(string.Format("http://s.web2.qq.com/api/getvfwebqq?ptwebqq={0}&clientid=53999199&psessionid=&t=1488053293431", ptwebqq)) as HttpWebRequest; vfrequest.Referer = "http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1"; HttpWebResponse vfresponse = (HttpWebResponse)vfrequest.GetResponse(); string jsoncontext = GetContent(vfresponse); Console.WriteLine(jsoncontext); SJsonSolver json1 = SJsonSolver.Creste(jsoncontext); vfwebqq = json1.Find("vfwebqq") as string; vfwebqq = vfwebqq.Substring(1, vfwebqq.Length - 3); #warning change this part to send_2 string datastring = "{\"ptwebqq\":\"" + ptwebqq + "\",\"clientid\":53999199,\"psessionid\":\"\",\"status\":\"online\"}"; /* * HttpWebRequest loginrequest = getRequest("http://d1.web2.qq.com/channel/login2"); * loginrequest.Referer = "http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2"; * loginrequest.Headers.Set("Origin", "http://d1.web2.qq.com"); * SetHeaderValue(loginrequest.Headers, "Host", "d1.web2.qq.com"); * // newrequest.Headers.Set("Host", "d1.web2.qq.com"); * * datastring = "r=" + UrlEncode(datastring, System.Text.UTF8Encoding.UTF8); * byte[] datas = System.Text.Encoding.UTF8.GetBytes(datastring); * postData(loginrequest, datas); */ HttpWebRequest loginrequest = send_d1("http://d1.web2.qq.com/channel/login2", datastring); #warning build the json HttpWebResponse loginresponse = loginrequest.GetResponse() as HttpWebResponse; string logincontext = GetContent(loginresponse); SJsonSolver json2 = SJsonSolver.Creste(logincontext); psessionid = json2.Find("psessionid") as string; psessionid = psessionid.Substring(1, psessionid.Length - 2); uin = json2.Find("uin") as string; getFriend(); getG(); getDisG(); getR(); getOnLine(); //smallrequest polling = new smallrequest(poll); //polling.BeginInvoke(null, null, null); //ssssssss /* * SJsonSolver jsonsolver = new SJsonSolver(context2); * string vfwebqq = jsonsolver.Find("vfwebqq"); */ Console.WriteLine("EndLogin"); poll(); }