1.

Solve : Perform an HTTP/1.1 POST in VBScript?

Answer»

I have had the idea to make a "Chat Autofixer" for XSketch.com, and in order to do this, I basically flood the chat with a message consisting of [ ]. I want to make it distributable, for my XSketch friends, and source-viewable. I'd like to do this using VBScript. Unfortunately, the server running XSketch is using GWT with a POST to send messages, and I don't know how to EXECUTE a POST in VBS. I only NEED to post a string, and I know what URL to post to. Does anyone know the code required to perform such an action?

PS> This will also help in my VB.NET application coming soon that will use POST.Ugh.  I wouldn't use VBScript for this.  Any language that can use a cURL library is a better bet.  But if you're determined, you might find some inspiration here: http://www.motobit.com/tips/detpg_post-binary-data-url/ Code: [Select]'URL to OPEN....
sUrl = "http://www.example.com/page.php"
'POST Request to send.
sRequest = "varname=value&varname=value"

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
Thanks to everyone for your helpfulness. I am now able to do what I was DESIRING to do in the first place. I officially declare this topic solved!



Discussion

No Comment Found