Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Call C# functions from anywhere using URL (HTTP server)
#14
AutoHotkey v2 example (edited to add try/catch):
 
Code:
Copy      Help
#Requires AutoHotkey 2.0

LaHttpCall("http://localhost:4455/Parameters", "a=aa&b=x+y", "password278351")

MsgBox(LaHttpCall("http://localhost:4455/Add", "x=100&y=2"))

LaHttpCall(url, params:="", password:="") {
    http := ComObject("WinHttp.Winhttprequest.5.1")
    http.Open("POST", url)
    if (password != "")
        http.SetCredentials("-", password, 0)
    http.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
    try {
        http.Send(params)
    } catch {
        MsgBox("No server!")
        ExitApp()
    }
    return http.ResponseText
}


Messages In This Thread
RE: Call C# functions from anywhere using URL (HTTP server) - by burque505 - 01-29-2024, 08:23 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)