[C#] 纯文本查看 复制代码
private void GetCode()
{
//获取Cookie
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "https://9714035371-ccgj.qq168.ws/ssid1?url=/js/jquery.js",
Method = "GET",
Referer = "https://9714035371-ccgj.qq168.ws/login",
ProxyIp = "127.0.0.1:8888",
};
HttpResult result = http.GetHtml(item);
string JSCookie = result.Cookie;
//获取验证码图片
item = new HttpItem()
{
URL = "https://9714035371-ccgj.qq168.ws/code?_=" + GetTimeC(),
Method = "GET",
UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36",
Referer = "https://9714035371-ccgj.qq168.ws/login",
ResultType = ResultType.Byte,
ProxyIp = "127.0.0.1:8888",
};
result = http.GetHtml(item);
imgCode.Source = LoadImage(result.ResultByte);
string ImgCodeCode = result.Cookie;
//获取Cookie
item = new HttpItem()
{
URL = "https://9714035371-ccgj.qq168.ws/ssid1?url=/default/js/qrcode.min.js",
Method = "GET",
Referer = "https://9714035371-ccgj.qq168.ws/login",
Cookie = JSCookie,
ProxyIp = "127.0.0.1:8888",
};
result = http.GetHtml(item);
string JSCookie2 = result.Cookie;
MyCookie = ImgCodeCode + ";" + JSCookie2;
}
private string OneKeyLogin()
{
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "https://9714035371-ccgj.qq168.ws/login",
Method = "POST",
Referer = "https://9714035371-ccgj.qq168.ws/login",
Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36",
ContentType = "application/x-www-form-urlencoded",
KeepAlive = true,
Cookie = MyCookie,
ProxyIp = "127.0.0.1:8888",
Postdata = "type=1&account=" + user + "&password=" + pass + "&code=" + txtCode.Text,
};
HttpResult result = http.GetHtml(item);
string html = result.Html;
string NewUrl = result.RedirectUrl;
item = new HttpItem()
{
URL = NewUrl,
Method = "GET",
Referer = "https://9714035371-ccgj.qq168.ws/login",
Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36",
Cookie = MyCookie,
};
result = http.GetHtml(item);
string Cookie = result.Cookie;
Cookie = HttpHelper.GetSmallCookie(Cookie);
item = new HttpItem()
{
URL = "https://9714035371-ccgj.qq168.ws/member/agreement",
Method = "GET",
Referer = "https://9714035371-ccgj.qq168.ws/login",
Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36",
Cookie = Cookie,
};
result = http.GetHtml(item);
html = result.Html;
Cookie = Cookie + MyCookie;
item = new HttpItem()
{
URL = "https://9714035371-ccgj.qq168.ws/member/index",
Method = "GET",
Referer = "https://9714035371-ccgj.qq168.ws/member/agreement",
Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36",
Cookie = Cookie,
};
result = http.GetHtml(item);
html = result.Html;
return html;
}
private System.Drawing.Image byteArrayToImage(byte[] Bytes)
{
MemoryStream ms = new MemoryStream(Bytes);
return System.Drawing.Bitmap.FromStream(ms, true);
}
BitmapSource LoadImage(Byte[] imageData)
{
using (MemoryStream ms = new MemoryStream(imageData))
{
var decoder = BitmapDecoder.Create(ms,
BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.OnLoad);
return decoder.Frames[0];
}
}
}