Answers for "POST http request from excel"

VBA
19

excel vba send HTTP POST to server

'VBA function to send HTTP POST to a server:

Function httpPost$(url$, msg$)
    With CreateObject("WinHttp.WinHttpRequest.5.1")
        .Open "POST", url, False
        .setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
        .setRequestHeader "Content-type", "application/x-www-form-urlencoded"
        '.setRequestHeader "secret-pass-key", "your-key"    <--if needed
        .send msg
        httpPost = .responseText
    End With
End Function

'-------------------------------------------------------------------------------------------

'Example usage:
response = httpPost(url, msg)

'-------------------------------------------------------------------------------------------

'Note: This same setup can be used for an HTTP PUT. Just change "POST" to "PUT".
'
'
'
Posted by: Guest on March-30-2020

Code answers related to "VBA"

Browse Popular Code Answers by Language