POST to an HTTPS page with VBScript


POST to an HTTPS page with VBScript



I'm trying to connect to an HTTPS page with a POST request. It is on an old website that uses ASP/VBScript (not ASP.Net). I can do this with PHP, but I'm not so good with ASP/VBScript, and it continually fails. Here's my code:


Dim httpObj, myURL, myResponseText

myURL = "https://example.com/mypage.php"
'Set httpObj = CreateObject("Microsoft.XmlHttp")
Set httpObj = CreateObject("MSXML2.ServerXMLHTTP")

httpObj.Open "POST", myURL, False
httpObj.SetRequestHeader "Content-Type", "Application/x-www-form-urlencoded"

httpObj.SetOption 2, 13056
httpObj.Send myXML.Xml

myResponseText = httpObj.ResponseText



I've tried with both types of objects shown above (and others). The SetOption line supposedly ignores any cert restrictions on the HTTPS site. I have a valid XML object named myXML.


SetOption


myXML





How do you know your doing wrong? Do you get an error?
– Lankymart
Jun 30 at 7:09





What is the response you get from the site, i.e. how exactly does the request fail? SetOption 2, 13056 should indeed ignore all certificate errors, so I don't see anything inherently wrong with your code.
– Ansgar Wiechers
Jun 30 at 10:39


SetOption 2, 13056





my bad, the basic plumbing was fine but the form data was malformed (just sending straight xml through as shown above). Once I fixed that, I got responses. Thanks to everyone who took a look!
– cbad
Jun 30 at 19:31









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Render GeoTiff to on browser with leaflet

How to get chrome logged in user's email id through website

using states in a react-navigation without redux