5 Replies Latest reply on Nov 5, 2019 7:43 AM by tony.johnson

    Using a VBscript to post HTTP

    harissalim

      Dear SW Community,

      I am trying to run an HTTP post using VB script. I am not successful. Need help in this regard.

       

      ========================

      Dim objArgs

      Dim sUrl

      Dim sRequest

      Set objArgs = Wscript.Arguments

       

      'URL to open....

      sUrl = "MYURL"

      'POST Request to send.

      sRequest = "MESSAGE" & objArgs(0)

       

      HTTPPost sUrl, sRequest

      Function HTTPPost(sUrl, sRequest)

        set oHTTP = CreateObject("Microsoft.XMLHTTP")

        oHTTP.open "POST", sUrl,false

        oHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

        oHTTP.setRequestHeader "Content-Length", Len(sRequest)

        oHTTP.send sRequest

        HTTPPost = oHTTP.responseText

      End Function

      ========================