Тема: AHK: Регистрация на mos.ru
Добрый день! Не могу залогиниться на mos.ru (ошибка на последнем Location), делаю пошагово, согласно запросам браузера (через Fiddler), может кто-нить сталкивался?
username := ""
Pass_name := ""
head_url := "https://gisogd.mos.ru"
reg_url := "https://login.mos.ru"
ComObjError(false)
HTTP := ComObjCreate("WinHTTP.WinHTTPRequest.5.1")
HTTP.Open("GET", head_url "/home")
HTTP.Send()
if (HTTP.ResponseText = "")
{
MsgBox, 262208, , % """" head_url """" " не доступен!!!"
ExitApp
}
ComObjError(true)
HTTP.Open("GET", head_url "/isogd/oauth2/authorization/sudir")
HTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36")
HTTP.Option(6) := False
HTTP.Send()
HTTP.WaitForResponse()
HTTP.Open("GET", HTTP.GetResponseHeader("Location"))
HTTP.SetRequestHeader("Content-Type", "text/html; charset=utf-8")
HTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36")
HTTP.Send()
HTTP.WaitForResponse()
location := HTTP.GetResponseHeader("Location")
HTTP.Open("GET", reg_url . HTTP.GetResponseHeader("Location"))
HTTP.SetRequestHeader("Content-Type", "text/html; charset=UTF-8")
HTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36")
HTTP.Send()
HTTP.WaitForResponse()
RegExMatch(HTTP.ResponseText, "name=""proofOfWork"" value='(\S+)'", match)
proofOfWork := match1
HTTP.Open("POST", reg_url . location)
HTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36")
data_send := % "proofOfWork=" proofOfWork "&isDelayed=false&login=" . username "&password=" . Pass_name "&bfp=1a0211a3dfc2e9dc1678ad3def923436"
HTTP.Send(data_send)
HTTP.WaitForResponse()
MsgBox % HTTP.GetResponseHeader("Location")
;~ MsgBox % HTTP.ResponseText
ExitApp