JiggyPiggy
Programmer
Hi there,
I have two bits of sample code that is supposed to post data to a website. The first works, the second doesn't but as far as I can tell, they should be the same. Any suggestions would be appreciated.
The one that works is a simple logon to the site page. I captured the headers when I manually logged on and got the following info:
POST login_verification.asp
.
.
Referer .
.
username=myuser&passw=mypassw
I am using data from an excel spreadsheet to post and have the following code that automatically logs me in...
public sub logon()
Dim MyInfo as string
Dim MyUrl as string
Dim objXML
MyUrl="MyInfo="username=myuser&passw=mypassw"
Set objXML = CreateObject("Microsoft.XMLHTTP")
objXML.Open "POST", MyUrl, False
objXML.setrequestheader "Content-Type", "application/x-objXML.send MyInfo
Set objXML = Nothing
end sub
This works fine and the response text I get is the page after logging in. What I can figure out is why similar code does not complete the next form. When I grabbed the header info when completing it manually, I got:
POST /framework/fwk_verification.asp?blah=12345&f_id=123123
.
.
Referer .
.
agh=None&complete=0
Following how the first one worked, I tried the following...
public sub filltheform()
Dim MyInfo as string
Dim MyUrl as string
Dim objXML
MyUrl="MyInfo="agh=None&complete=0"
Set objXML = CreateObject("Microsoft.XMLHTTP")
objXML.Open "POST", MyUrl, False
objXML.setrequestheader "Content-Type", "application/x-objXML.send MyInfo
Set objXML = Nothing
end sub
But this game me a message that the object moved. If I substitued framework.asp for fwk_verification.asp, it just refreshes the page.
Any ideas?
Thanks,
I have two bits of sample code that is supposed to post data to a website. The first works, the second doesn't but as far as I can tell, they should be the same. Any suggestions would be appreciated.
The one that works is a simple logon to the site page. I captured the headers when I manually logged on and got the following info:
POST login_verification.asp
.
.
Referer .
.
username=myuser&passw=mypassw
I am using data from an excel spreadsheet to post and have the following code that automatically logs me in...
public sub logon()
Dim MyInfo as string
Dim MyUrl as string
Dim objXML
MyUrl="MyInfo="username=myuser&passw=mypassw"
Set objXML = CreateObject("Microsoft.XMLHTTP")
objXML.Open "POST", MyUrl, False
objXML.setrequestheader "Content-Type", "application/x-objXML.send MyInfo
Set objXML = Nothing
end sub
This works fine and the response text I get is the page after logging in. What I can figure out is why similar code does not complete the next form. When I grabbed the header info when completing it manually, I got:
POST /framework/fwk_verification.asp?blah=12345&f_id=123123
.
.
Referer .
.
agh=None&complete=0
Following how the first one worked, I tried the following...
public sub filltheform()
Dim MyInfo as string
Dim MyUrl as string
Dim objXML
MyUrl="MyInfo="agh=None&complete=0"
Set objXML = CreateObject("Microsoft.XMLHTTP")
objXML.Open "POST", MyUrl, False
objXML.setrequestheader "Content-Type", "application/x-objXML.send MyInfo
Set objXML = Nothing
end sub
But this game me a message that the object moved. If I substitued framework.asp for fwk_verification.asp, it just refreshes the page.
Any ideas?
Thanks,