按键精灵电脑版为什么停更啊,手机版的post和json解析比电脑版的真好用吧
json解析
♾️ vb 代码:Function JsonDecode(str, json路径)//json解析函数
Set sc = CreateObject("MSScriptControl.ScriptControl")
sc.Language = "JScript"
sc.AddCode "var tmp = " & str & ";"
JsonDecode = sc.Eval("tmp." & json路径)
End Function
调用方式
♾️ vb 代码:JsonDecode(Object,"msg")
post
♾️ vb 代码:Function HttpPost(addr, params)//post函数
Set WinHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
WinHttp.Open "POST", addr, False
WinHttp.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
WinHttp.SetRequestHeader "User-Agent", "Apifox/1.0.0"
WinHttp.SetRequestHeader "Content-Length",len(str)
WinHttp.Send params
httpPost = WinHttp.ResponseText
Set WinHttp = Nothing
End Function
调用方式
♾️ vb 代码:HttpPost(post内容)