Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to post data to server without filling out web form.

Status
Not open for further replies.

JiggyPiggy

Programmer
Feb 3, 2005
5
CA
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,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top