发送Get请求
发送Post请求:(包括json格式的内容)
Function sendHttpPost(posturl,params) Dim http Set http = CreateObject("MSXML2.ServerXMLHTTP") http.Open "POST",posturl,False,"","" http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" http.Send(params) If http.Status = "200" Then sendHttpPost = http.responseText Else sendHttpPost = http.Status & "<br />" & http.responseText End If Set http = nothing End Function ' 发送json内容 Function sendHttpPost2(posturl,params) Dim http Set http = CreateObject("MSXML2.ServerXMLHTTP") http.Open "POST",posturl,False,"","" http.setRequestHeader "Content-Type", "application/json" http.Send(params) If http.Status = "200" Then sendHttpPost2 = http.responseText Else sendHttpPost2 = http.Status & "<br />" & http.responseText End If Set http = nothing End Function ' 使用 ' ret = sendHttpPost("http://127.0.0.1:9090/", "{hello=123}") ' ret = sendHttpPost("http://localhost:8080/test03","id=231&name=Wee") ret = sendHttpPost2("http://localhost:9999/user/login","{""username"":""admin"",""password"":""123456""}") MsgBox ret
**
标签:Status,Function,http,Get,VBS,End,sendHttpPost,responseText,Http From: https://www.cnblogs.com/htj10/p/17151688.html