Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 Off topic

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2003-11-14 : 14:36:38
This is a question a friend of mine asked me to research so my info is sketchy.

There's an existing web form running on a remote server. A few input fields. Works fine.

The question is how can an application be written to read the form, fill in the fields and submit the form - without requiring a human and a browser.

Anyone done this before or have a link that describes the technique?

Sam

MichaelP
Jedi Yak

2489 Posts

Posted - 2003-11-14 : 15:08:30
I've not done this exact thing, but I have done stuff with .Net where I've simulated a form POST to a remote server.

For what you are talking about, You'd probably need a webbrowser control, have it open the page, itterate through the controls, populate the ones you want, and then do the form post.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-11-14 : 15:15:55
It's that part "then do a form post" that gets me.

Can you email or post a snippet of .NET that does this?

Sam
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-11-14 : 15:21:24
if it uses a GET, then it's just building the querystring in the URL and browsing to that URL using a webbrowser control. that would be pretty easy i would think.

For a post, it'd be a different story ... i'll do some checking for you, i think i've done this before.

- Jeff
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2003-11-14 : 16:34:49
Sam, I'll e-mail it to ya.
There's some stuff in there that I'm not sure I want to post to the rest of the world.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2003-11-15 : 09:57:25
Check out XMLHTTP - scid=http://support.microsoft.com:80/support/kb/articles/Q290/5/91.asp&NoWebContent=1

Its not just for XMl -- and it is very simple...

The following asp code demos MSXML3 XMLHTTP get and post.

The get will retrieve the SQLTeam search page into a variable strReturn which can be interrogated for the form elements to build and call the post which, in this example, is a search as of 5 days ago for the keyword XMLHTTP...

<%

Dim objHTTP,strReturn
Set objHTTP = Server.CreateObject("MSXML2.XMLHTTP.3.0")

'GET
'objHTTP.open "Get", "http://www.sqlteam.com/forums/search.asp", false
'objHTTP.send
'strReturn = objHTTP.responseText
'response.write strReturn

'POST
objHTTP.Open "POST", "http://www.sqlteam.com/forums/search.asp?mode=DoIt", False
objHTTP.setRequestHeader "lastCached", now()
objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
'The post values
objHTTP.Send "Search=XMLHTTP&andor=3&Forum=0&SearchMessage=0&SearchDate=5&SearchMember="
Response.Write objHTTP.responseText
Set objHTTP = Nothing
%>

Once XTML becomes more widely used, this will become even easier.
Get the page. Apply a stylesheet to strip out form elements. Post the form. Apply a stylesheet to retrieve the desired contents.
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2003-11-16 : 19:51:37
Are you trying to stress-test the page? You might check out Microsoft's Web Application Stress Tool at [url]http://www.microsoft.com/downloads/details.aspx?FamilyID=e2c0585a-062a-439e-a67d-75a89aa36495&DisplayLang=en[/url] and related notes at:

http://support.microsoft.com/default.aspx?scid=kb;en-us;313559 and
http://support.microsoft.com/default.aspx?scid=kb;en-us;815160

--------------------------------------------------------
Visit the SQLTeam Weblogs at [url]http://weblogs.sqlteam.com[/url]
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-11-18 : 09:37:45
Thanks everyone. I got what was needed.

Sam
Go to Top of Page
   

- Advertisement -