Simulate HTML page

Hello.
I have a HTML page with 3 TextBoxes, the first with username, the second with password and the third to write XML code. Then there's a submit button that send the content to an ASP page.

How can i, using VB (and if possible VBA Access), do this programatically in order to automate this process?

All the Web site is HTTPS and also needs digital certificate validation.
[402 byte] By [lribeiro] at [2007-11-20 11:17:40]
# 1 Re: Simulate HTML page
Do you actually want to do this in Visual Basic? Or do you mean VBScript?
PeejAvery at 2007-11-10 3:56:13 >
# 2 Re: Simulate HTML page
You're right. That was VB Script i'd want to say.
lribeiro at 2007-11-10 3:57:13 >
# 3 Re: Simulate HTML page
Well, to change values of textboxes...

<script type="text/vbscript">
document.FORMNAME.INPUTNAME.value = ""
</script>
To submit the form, you will want it to submit through a different window so that you don't loose the current pages information. Then you will have to give some time for that page to load before submitting a new form.

<script type="text/vbscript">
document.FORMNAME.submit
</script>
Now, since you haven't said where the data is coming from, it will be up to you to loop through it. Remember that Google (http://www.google.com) is a great resource. Do some searching and learning!
PeejAvery at 2007-11-10 3:58:11 >
# 4 Re: Simulate HTML page
Thanks for your quick answer. To be more exact about the method, the process of sending info to that web site can be using the HTML page or, acording to the owner of the web site, it can be linked directly from another applications using a ASP link.
Imagine that the ASP link in question is https://test.asp. Acording to the web site manual, we can connect applications (Microsoft Access) using POST method and the HTTP request should contain Username, Password and the XML string built earlier. I've already have the XML string, but i'm not been able to connect to the remote server.

Could you point me to a possible solution using vba access ?
lribeiro at 2007-11-10 3:59:14 >
# 5 Re: Simulate HTML page
So you are wanting to do this from the ASP.NET of another server?
PeejAvery at 2007-11-10 4:00:12 >
# 6 Re: Simulate HTML page
The target page is an Extranet of another company and as i said, acording to the manual, if we make an Http request giving username, password and xml, the Extranet stores the xml sent. I've tryied to do a vba function usin WinHTTP but the error i get is "A connection to the server could not be established". I'm sending you the code for you to see if that something wrong.

Sub httpPost()

Dim HttpReq

Dim strFileName As String
Dim strFileText As String
Dim intFileNo As Integer

Set HttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")

strFileName = "XML_FILE.XML"
intFileNo = FreeFile()
Open strFileName For Input As #intFileNo
strFileText = Input(LOF(intFileNo), intFileNo)
Close #intFileNo

sURL = "https://test.asp"
UserName = "user"
Password = "password"

params = params & "Username=" & UserName
params = params & "&Password=" & Password
params = params & "&Xml=" & strFileText

HttpReq.SetClientCertificate ("LOCAL_MACHINE\Personal\Luis Miguel Ribeiro")

HttpReq.Open "POST", sURL, False
HttpReq.SetRequestHeader "content-type", "application/x-www-form-urlencoded"

Status = HttpReq.Status

MsgBox HttpReq.ResponseText

End Sub
lribeiro at 2007-11-10 4:01:11 >
# 7 Re: Simulate HTML page
No. I don't see anything wrong with the code. However, you can try other object protocols. Do any of the following 4 work for you?

HttpReq = CreateObject("Microsoft.XMLHTTP")
HttpReq = CreateObject("MSXML2.ServerXMLHTTP")
HttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
HttpReq = CreateObject("WinHttp.WinHttpRequest")
PeejAvery at 2007-11-10 4:02:10 >
# 8 Re: Simulate HTML page
I stil receive "A connection with the server could not be established". My company network has a proxy server. Could it be because of that?
lribeiro at 2007-11-10 4:03:12 >