由于我最近在做到一個小模塊,需要在PC客戶端顯示網站資料(出于安全管理原因,電腦禁止上網,所以不能從網頁登錄)
我已經做了很多辦法,無法測驗完整,特來請各位大神幫忙看一下。我用程式該如何實作呢?
正常登陸得到2組資料:
獲取到的第一組資料
GET http://ling.*****.com/security/publicKey?_=1561168711477 HTTP/1.1
Host: ling.******.com
Connection: keep-alive
Accept: application/json, text/javascript, */*; q=0.01
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3767.0 Safari/537.36
token: 6e4f2670-66c7-4c53-af0f-290ae45d82e5
Referer: http://ling.*****t.com/
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,zh-TW;q=0.6
Cookie: token=6e4f2670-66c7-4c53-af0f-290ae45d82e5; Hm_lvt_39a4a93d9150c2e864125e74931e5107=1561104296,1561111362,1561115798,1561168711; Hm_lpvt_39a4a93d9150c2e864125e74931e5107=1561168711
正式POST登錄的資料
POST http://ling.******.com/security/login HTTP/1.1
Host: ling.******.com
Connection: keep-alive
Content-Length: 243
Accept: application/json, text/javascript, */*; q=0.01
Origin: http://ling.******.com
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3767.0 Safari/537.36
token: 6e4f2670-66c7-4c53-af0f-290ae45d82e5
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Referer: http://ling.******.com/
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,zh-TW;q=0.6
Cookie: token=6e4f2670-66c7-4c53-af0f-290ae45d82e5; Hm_lvt_39a4a93d9150c2e864125e74931e5107=1561104296,1561111362,1561115798,1561168711; Hm_lpvt_39a4a93d9150c2e864125e74931e5107=1561168711; JSESSIONID=4745db1a-93c3-4f4f-8f12-4a5d55a47892
userName=UserID&password=sKqyBiivodUFxdnjJ7VE7RQZQXgkCKbb%2FLSSeKka1iNrk261qONxXwGXui4VqbGCGekrSOnoe%2BvmwTmjuj8yzGuXL2vOC1J2WRoLbXSx4UzuNdHEpV2OfNRTMJA%3D&rememberMe=false&loginType=pwd
我的代碼
long Untime = new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds();//
string GEUrl = "http://ling.******.com/security/publicKey?_=" + Untime;
label1.Text = GEUrl;
textBox1.Text = "UserID";
textBox2.Text = "sKqyBiivodUFxdnjJ7VE7RQZQXgkCKbb%2FLSSeKka1iNrk261qONxXwGXui4VqbGCGekrSOnoe%2BvmwTmjuj8yzGuXL2vOC1J2WRoLbXSx4UzuNdHEpV2OfNRTMJA%3D";
HttpHeader header = new HttpHeader();
header.accept = "application/json, text/javascript, */*; q=0.01";
header.contentType = "application/x-www-form-urlencoded";
header.method = "POST";
header.userAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3767.0 Safari/537.36";
header.maxTry = 300;
string html = HTMLHelper.GetHtml(HTMLHelper.GetCooKie("http://ling.******.com/security/login", "userName=" + textBox1.Text + "&password=" + textBox2.Text + "&rememberMe=false&loginType=pwd", header), "http://ling.******.com/express/waybill/list", header);
Console.WriteLine(html);
Console.ReadLine();
}
CookieContainer mycookie = new CookieContainer();
uj5u.com熱心網友回復:
由于我最近在做到一個小模塊,需要在PC客戶端顯示網站資料(出于安全管理原因,電腦禁止上網,所以不能從網頁登錄)封的埠還是 IP 。
uj5u.com熱心網友回復:
電腦禁止上網,所以不能從網頁登錄??是不能從瀏覽器登錄吧
、、你的代碼也算是從網頁登錄。。。
看半天 我沒看懂 現在的問題到底是什么?
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/28026.html
標籤:Web Services
