如何使用 AutoHotKey V2 创建 POST 请求?

问题描述 投票:0回答:1

如何使用 AutoHotKey V2 创建 POST Rest API 请求?我在互联网上找到的每个现有脚本仅适用于 AutoHotKey V1。是否有现有的实用程序脚本可以促进此过程?

automation autohotkey
1个回答
0
投票

使用 COM 对象进行 HTTP 请求的函数的基本示例。

#Requires AutoHotkey v2.0.11+

url := 'https://reddit.com/r/AutoHotkey/new/'
MsgBox(http('Post', url))

http(verb, url) {
    ; https://learn.microsoft.com/en-us/windows/win32/winhttp/winhttprequest
    web := ComObject('WinHttp.WinHttpRequest.5.1')
    web.Open(verb, url)
    web.Send()
    web.WaitForResponse()
    return web.ResponseText
}
© www.soinside.com 2019 - 2024. All rights reserved.