首页 新闻 搜索 专区 学院

163邮箱模拟登录

0
悬赏园豆:20 [待解决问题]

我想模拟163用户登录,通过了抓包分析得到路径(我不能确保我的分析是否正确)希望有人能帮忙分析一下,新手上路。。。我的主要代码如下:

private void GetCookies()
{
string username = "lstcJaney@163.com";
string password = "08339314lry";
string url2 = "http://email.163.com/errorpage/err_163.htm";
CookieContainer myCookieContainer = new CookieContainer();
string indata = string.Empty;
string url = "https://ssl.mail.163.com/entry/coremail/fcg/ntesdoor2?funcid=loginone&language=-1&passtype=1&iframe=1&product=mail163&from=web&df=email163&module=&uid=lstcJaney@163.com&style=-1";
indata = "username=" + username + "&url2=" + url2 + "&savelogin=0&password=" + password;
PostData(url, indata, myCookieContainer);
url = "http://uinfo.mail.163.com/contactproxy/getbdayinfo.do?uid=lstcjaney@163.com&view=bdayinfo_client";
string backurl = "http://webmail.mail.163.com/app/api/service_backurl.jsp?sid=rBWPCXagzGnwJNrZhqggNMrsNUgAxNEN&callback=parent.$I('product.Gift').load";
indata = "fids=" + username.ToLower() + "&backurl=" + backurl;
PostData(url, indata, myCookieContainer);
//url = "http://webmail.mail.163.com/app/api/service_backurl.jsp?sid=rBWPCXagzGnwJNrZhqggNMrsNUgAxNEN&callback=parent.$I('product.Gift').load";
//indata = "contact={\"code\":\"201\",\"pcode\":\"201\"}";
//PostData(url, indata, myCookieContainer);
this.webBrowser1.Navigate("http://webmail.mail.163.com/js4/main.jsp?sid=vAtsbBlJTLQGVIsrTjJJyajpYIEXuJOr#module=welcome.WelcomeModule");

}
/// <summary>
/// Post数据
/// </summary>
/// <param name="url"></param>
/// <param name="indata"></param>
/// <param name="myCookieContainer"></param>
/// <returns></returns>
public static string PostData(string url, string indata, CookieContainer myCookieContainer)
{
string outdata = "";
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
myHttpWebRequest.ContentType = "application/x-www-form-urlencoded";
myHttpWebRequest.ContentLength = indata.Length;
myHttpWebRequest.Method = "POST";
myHttpWebRequest.KeepAlive = true;
myHttpWebRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; 360SE)";
myHttpWebRequest.Accept = "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/xaml+xml, application/x-ms-xbap, application/x-ms-application, */*";
myHttpWebRequest.CookieContainer = myCookieContainer;
try
{
Stream myRequestStream = myHttpWebRequest.GetRequestStream();
StreamWriter myStreamWriter = new StreamWriter(myRequestStream, Encoding.GetEncoding("gb2312"));
myStreamWriter.Write(indata);
myStreamWriter.Close();
myRequestStream.Close();
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
myHttpWebResponse.Cookies = myCookieContainer.GetCookies(myHttpWebRequest.RequestUri);
Stream myResponseStream = myHttpWebResponse.GetResponseStream();
//myCookieContainer = myHttpWebRequest.CookieContainer;
StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("gb2312"));
outdata = myStreamReader.ReadToEnd();
myStreamReader.Close();
myResponseStream.Close();

}
catch (Exception ex)
{
}
return outdata;
}

c#
秦小米的主页 秦小米 | 初学一级 | 园豆:182
提问于:2011-12-06 17:46
< >
分享
所有回答(2)
0

代码也不先格式化一下!

Jackin | 园豆:224 (菜鸟二级) | 2012-03-23 12:58
0

哥们,你也不怕别人拿你的邮箱干坏事。

AALMIX | 园豆:204 (菜鸟二级) | 2013-11-12 12:13
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册