Private Sub Command4_Click()
Dim oHttp As Object
Set oHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
' 设置请求的 URL 和方法(GET 或 POST)
oHttp.Open "GET", "APIURL(https://......)", False
' 可以设置请求头、发送数据等其他配置(根据需要进行修改)
oHttp.setRequestHeader "Content-Type", "application/json"
oHttp.setRequestHeader "Authorization", "Bearer token123"
' 发送请求
oHttp.Send
' 获取响应内容
Dim responseText As String
responseText = oHttp.responseText
' 可以对响应内容进行处理,比如解析 JSON 数据等
MsgBox responseText
' 释放资源
Set oHttp = Nothing
End Sub
07-09
297
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交