110,571
社区成员
发帖
与我相关
我的任务
分享
static string HostUrl = "http://www.renren.com/SysHome.do";//xiaonei主页
static string LoginUrl = "http://www.renren.com/PLogin.do";//login主页
static CookieContainer cookecn = new CookieContainer();
static string email = "用户名";
static string pwd = "密码";
static string fisrtgethost = string.Empty;
static string Cookiesstr = string.Empty;
HttpWebRequest request = null;
HttpWebResponse response = null;
try
{
request = (HttpWebRequest)WebRequest.Create(LoginUrl);
request.Method = "POST";
request.Referer = "http://www.renren.com/SysHome.do";
request.ContentType = "application/x-www-form-urlencoded";
request.AllowAutoRedirect = false;
byte[] postdatabtyes = Encoding.UTF8.GetBytes(postdata);
request.ContentLength = postdatabtyes.Length;
request.CookieContainer = cookecn;
request.KeepAlive = true;
Stream requeststream = request.GetRequestStream();
requeststream.Write(postdatabtyes, 0, postdatabtyes.Length);
requeststream.Close();
response = (HttpWebResponse)request.GetResponse();
......