HttpWebRequese模拟登录网站,返回html显示"签名值不合法",求助!
我用HttpWebRequese模拟登录xiaomi网站,登录不成功返回的HTML中提示"签名值不合法",如下:
<p class="retrieve_pwd">提示</p>
<div class="email_tip">签名值不合法</div>
<p class="retrieve_pwd">提示</p>
<div class="email_tip">签名值不合法</div>
string url = "https://account.xiaomi.com/pass/serviceLoginAuth2";
string postData = "user=******&pwd=*******";
byte[] byteArray = Encoding.UTF8.GetBytes(postData); // 转化
CookieContainer cc = new CookieContainer();
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
webRequest.Accept = "text/html, application/xhtml+xml, */*";
webRequest.Referer = "https://account.xiaomi.com/pass/serviceLogin";
webRequest.UserAgent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)";
webRequest.AutomaticDecompression = DecompressionMethods.GZip;
webRequest.CookieContainer = cc;
webRequest.Method = "POST";
webRequest.KeepAlive=true;
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.ContentLength = byteArray.Length;
Stream newStream = webRequest.GetRequestStream();
// Send the data.
newStream.Write(byteArray, 0, byteArray.Length); //写入参数
newStream.Close();
HttpWebResponse response = null;
try
{
response = (HttpWebResponse)webRequest.GetResponse();
}
catch (System.Exception ex)
{
Console.WriteLine(ex.Message);
}
if (response != null)
{
StreamReader sr2 = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
string text2 = sr2.ReadToEnd();
}
...全文
相关推荐
A Survey of Generative Multi-Agent Social Simulation Methods_生成式多智能体社会模拟方法综述.md
ArxivReview学术论文研究综述,详细内容可访问:https://www.arxivreview.com/surveys
A Survey of LLM Mathematical Reasoning and Problem Solving_LLM数学推理与问题求解综述.md
ArxivReview学术论文研究综述,详细内容可访问:https://www.arxivreview.com/surveys
A Survey of Few-Shot Learning Methods_小样本学习方法综述_677.md
ArxivReview学术论文研究综述,详细内容可访问:https://www.arxivreview.com/surveys
A Survey of Scene Text Detection and Recognition Methods_场景文本检测与识别方法综述.md
ArxivReview学术论文研究综述,详细内容可访问:https://www.arxivreview.com/surveys
A Survey of Multi-Task Learning Optimization and Parameter Sharing_多任务学习优化与参数共享综述.md
ArxivReview学术论文研究综述,详细内容可访问:https://www.arxivreview.com/surveys


