System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
Try
sUrl = "https://quizlet.com/": Link = ""
xmlhttp = DirectCast(WebRequest.Create(sUrl), HttpWebRequest)
xmlhttp.Timeout = 6000 : xmlhttp.AllowAutoRedirect = False
xmlhttp.Method = "GET": xmlhttp.KeepAlive = False
xmlhttp.Host = "quizlet.com"
xmlhttp.Headers.Add("upgrade-insecure-requests", "1")
xmlhttp.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"
xmlhttp.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
xmlhttp.Headers.Add("sec-fetch-site", "none")
xmlhttp.Headers.Add("sec-fetch-mode", "navigate")
xmlhttp.Headers.Add("sec-fetch-dest", "document")
xmlhttp.Headers.Add("accept-language", "zh-CN,zh;q=0.9,en;q=0.8,fr;q=0.7,zh-TW;q=0.6,ja;q=0.5")
'xmlhttp.Headers.Add("accept-encoding", "gzip, deflate")
Using rep As HttpWebResponse = xmlhttp.GetResponse()
Link = rep.GetResponseHeader("Location")
End Using
Catch ex As WebException : If ex.Status <> WebExceptionStatus.Timeout Then Throw
Catch ex As Exception : Throw
Finally : xmlhttp.Abort() : xmlhttp = Nothing
End Try
模擬抓包抓到的發出去后回傳 遠程服務器回傳錯誤: (403) 已禁止。
不知道什么原因導致的,請會的指點12
uj5u.com熱心網友回復:
大概率是COOKIE上加驗證了。第一次請求以后,把cookie存下來,后邊所有請求都帶上它們。轉載請註明出處,本文鏈接:https://www.uj5u.com/net/272721.html
標籤:VB.NET
上一篇:多執行緒改變Ui界面
