如果能模拟,请问该如何具体实现。
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(requestUrlString);
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] data = encoding.GetBytes(loginpostData);
myRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0";
myRequest.Accept = "application/json, text/javascript, */*; q=0.01";
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.Referer = "http://www.ewt360.com/";
myRequest.Host = "www.ewt360.com";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();
newStream.Write(data, 0, data.Length);
newStream.Close();
myRequest.CookieContainer = new CookieContainer();
//将请求的结果发送给客户端(界面、应用)
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
myResponse.Cookies = myRequest.CookieContainer.GetCookies(myRequest.RequestUri);
cookie.Add(myResponse.Cookies);
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);
return reader.ReadToEnd();
我的代码在获取响应的时候报错了,我想在一个网站上模拟登陆,发现它登陆的时候发送了三个XHR请求,请问我是不是这三个请求都要模拟一遍,还是只要模拟第一个请求呢?没有C币了真心求好心人帮助,做这个数据抓取我已经做的心力憔悴了