Sub CallAPI()
Dim url As String
Dim req As Object
Dim jsonStr As String
'定义URL和JSON字符串
url = "http://10.1.1.110/v1/oauth/accessToken"
js"appKey"": ""YourAppKey"", ""appSecret"": ""YourAppSecret""}"
'创建WinHttpRequest对象
Set req = CreateObject("WinHttp.WinHttpRequest.5.1")
'打开连接
req.Open "POST", url, False
'设置请求头
req.SetRequestHeader "Content-Type", "application/json"
'发送POST数据
req.Send (jsonStr)
'获取返回内容
If req.Status = 200 Then
MsgBox req.ResponseText
Else
MsgBox "请求失败:" & req.Status & " " & req.StatusText
End If
'释放对象
Set req = Nothing
End Sub