msgbox curl GET https vto pe api user key xxx method progress id curl

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
msgbox, % curl("GET", "https://vto.pe/api", "'{""user"" : 1, ""key"" : ""xxx"", ""method"" : ""progress"", ""id"" : [1, 2]}'")
curl(method, adress, package := "", user_agent := "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36 u01-05", error_log := 0, time_out := 0)
{
if (GetOSVersion() == 7)
{
RegWrite, REG_DWORD, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp, DefaultSecureProtocols, 2560
RegWrite, REG_DWORD, HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp, DefaultSecureProtocols, 2560
}
if (!RegExMatch(adress, "^http[s]?:\/\/.*\..*$"))
return error_log ? "Invalid URL adress (#1)" : false
else if (!DllCall("Wininet.dll\InternetGetConnectedState", "Str", 0x20, "Int", 0))
return error_log ? "Not internet connection (#2)" : false
try
{
temp_package := ""
for k, v in package
temp_package .= (A_Index > 1 ? "&" : (method == "POST" ? "" : "?")) k "=" (IsObject(v) ? JSON.Encode(v) : v)
http := ComObjCreate("WinHttp.WinHttpRequest.5.1")
http.Open(method, adress (method != "POST" ? temp_package : ""), false)
http.SetRequestHeader("Referer", adress)
http.SetRequestHeader("User-Agent", user_agent)
http.SetRequestHeader("Content-Type", "application/json")
http.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
http.SetRequestHeader("Pragma", "no-cache")
http.SetRequestHeader("Cache-Control", "no-cache, no-store")
http.SetRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT")
http.Send((method == "POST" ? temp_package : ""))
http.WaitForResponse(time_out ? time_out : 0)
if (!StrLen(http.ResponseText))
return error_log ? "Empty response (#3)" : false
else
{
if (http.Status !== 200)
return error_log ? http.Status "(" http.StatusText ") (#4)" : false
else
{
ResponseText := RegExReplace(http.ResponseText, "<br>", "`n")
ResponseText := RegExReplace(ResponseText, "<t>", "`t")
ResponseText := RegExReplace(ResponseText, "<br \/>", "`n")
return ResponseText
}
}
}
catch e
return error_log ? e.message "(#5)" : false
}
GetOSVersion()
{
VarSetCapacity(v,148), NumPut(148,v)
DllCall("GetVersionEx", "uint", &v)
os := NumGet(v,4) "." NumGet(v,8) "." SubStr("0000" NumGet(v,12), -3)
if (RegExMatch(os, "^(\d+)\.(\d+)", out_pars))
{
if (out_pars1 == 10)
Return 10
else if (out_pars1 == 6 && out_pars2 > 1)
Return 8
}
Return 7
}