I have a problem regarding excel VBA HTTP request and JavaScript. I want to do a search on an intranet site via "POST" but the submit button does seem to run a JavaScript to reload the site but I don't get how.
Public Function XmlHttpTutorial()
Dim xmlhttp As New MSXML2.XMLHTTP60
Set xmlhttp = CreateObject("MSXML2.serverXMLHTTP")
Dim HTMLDoc As New HTMLDocument
Dim myurl As String
myurl = "http://www.website.de"
xmlhttp.Open "POST", myurl, False
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.setRequestHeader "User-Agent", "Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0)1"
xmlhttp.setRequestHeader "Cookie", "serverTimeOffset=-3600149; browserTimeZone=-60;"
xmlhttp.Send ("var1=variable&var2=variable&var3=variable")
Debug.Print xmlhttp.responseText
End Function
This is the button itself
<input type="submit" name="button" tabindex="8" value="Find" onclick="closeWindow();uppercaseForm( this.form );" class="btn-small">
"closeWindow" just closes the window and "uppercaseForm" just puts all Input uppercase
and this is the Header
<form name="arrivalQueryForm" method="post" action="/opslink/arrivalQuery.do" onsubmit="setWindowId(this, 'windowId');">
the setWindowID only gets the window.name and replace brackets.
I have no idea how I get the right site back because nothing seems to work so far.