post登录dz论坛测试了一下 获取验证码的时候 2次请求应该不一样 但是实际获取的确是一样的老大 这是什么情况 附上源码
[C#] 纯文本查看 复制代码 string formhash;
string loginHash;
string secondHash;
string cookiesQian;
public Form1()
{
InitializeComponent();
HttpHelper help = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "http://data.loulanpo.com/member.php?mod=logging&action=login",
Method = "get",
ContentType = "text/html; charset=gbk",
};
HttpResult result = help.GetHtml(item);
string html = result.Html;
cookiesQian = result.Cookie;
string idhash = HttpHelper.GetBetweenHtml(html, "<span id=\"seccode_", "\"></span>");
formhash = HttpHelper.GetBetweenHtml(html, "<input type=\"hidden\" name=\"formhash\" value=\"", "\" />");
loginHash = HttpHelper.GetBetweenHtml(html, "loginhash=", "\"");
secondHash = HttpHelper.GetBetweenHtml(html, "<span id=\"seccode_", "\"></span>");
string sssss = ConvertDateTimeInt(DateTime.Now);
HttpItem itemQian = new HttpItem()
{
URL= "http://data.loulanpo.com/misc.php?mod=seccode&action=update&idhash="+idhash+"&"+ ConvertDateTimeInt(DateTime.Now) + "&modid=member::logging",
Referer = "http://data.loulanpo.com/member.php?mod=logging&action=login",
Accept= "application/javascript, */*;q=0.8",
UserAgent= "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko",
Host = "data.loulanpo.com",
Method ="GET",
Cookie =cookiesQian,
};
HttpResult resultQian = help.GetHtml(itemQian);
string update = HttpHelper.GetBetweenHtml(resultQian.Html, "height=\"30\" src=\"", "\" class=");
cookiesQian = itemQian.Cookie;
HttpItem image1 = new HttpItem()
{
URL = "http://data.loulanpo.com/" + update,
Referer = "http://data.loulanpo.com/member.php?mod=logging&action=login",
Method = "GET",//URL 可选项 默认为Get
ContentType = "image/png",
Accept = "image/png, image/svg+xml, image/*;q=0.8, */*;q=0.5",
UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko",
Host = " data.loulanpo.com",
Cookie = cookiesQian,
};
string collesi = image1.Cookie;
this.pictureBox1.Image = help.GetImage(image1);
HttpResult xxxxx = help.GetHtml(image1);
string ddddd= xxxxx.Html;
}
/// <summary>
/// 将c# DateTime时间格式转换为Unix时间戳格式
/// </summary>
/// <param name="time">时间</param>
/// <returns>long</returns>
public static string ConvertDateTimeInt(System.DateTime time)
{
//double intResult = 0;
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0));
long t = (time.Ticks - startTime.Ticks) / 10;
string s = "0." + t.ToString();
return s;
}
下面是post的cookies图片
|