Click to See Complete Forum and Search --> : how to complete a form automatically?


vma
December 12th, 2003, 06:27 AM
There are some sites where you have to register for something, anything, so the site asks you for: name, e-mail, pass, address... What I need to know is how can I fill this form automatically? I mean it doesn't have to open IE or anything. I think that this is done by listening the string that IE sends to that server or something. I really would like to know how to do this. What I want is have 5-6 .txt files and get from there the name, e-mail bla bla and sent that string to the server. How can I see that string that is transmited to the server? I am in programming for more than 10 years, I work in VC++, VC#, VB, php but never had to do such a thing and I don't know the whay this stuff works.
Thank you in advance!

khp
December 14th, 2003, 02:21 AM
Look at the page source, you should see a <form action="serversidetarget.cgi"> element somewhere, the action attribute tells you the address of the serverside script that recieves the request. in the form the there should be some <input> and <select> and <textarea> elements all of which should have a name attribute, this tells you the names of the variables that the serverside script expect to receive.
The name/value pairs can be either encoded directly into the url, like this http://server.side.script/url.cgi?name1=value1&name2=value2&name3=value3
or encoded into the body of the http request, which encoding to use depends on the method attribute specified in the form element.

vma
December 15th, 2003, 02:15 AM
Thanks I get the ideea but how could I know if the request is a link in that form that you say like .../aaa.cgi?name1=val1&name2=value2... or is in the body of the http request? When I press the submit button all I see in the status bar is www.blablablasite.com/aaa.cgi... So I don't know what the last 3 points stands for. Thank you!

khp
December 15th, 2003, 04:59 AM
If the method attribute on the form is set to "get" then the name/value pairs are encoded into the url. If the method attribute is set to "post" the name/value pairs are encoded in the http request body.
As far as the three dots go, they don't stand for anything, they are just part of the name of the cgi script, or rather part of the url that the http server recognises as a reference to the cgi script.

vma
December 15th, 2003, 05:17 AM
So let's say that I have the folowing form, that uses a post method. How can I know the format of the encoded request body? Or this requires a post leastener to catch that message?

<HTML><HEAD></HEAD><BODY>
<FORM ACTION="http://server.side.script/create.cgi" METHOD=POST onSubmit="doPop();">
<INPUT TYPE=HIDDEN NAME=CHECKCODE VALUE=10>

<TABLE width=450>
<TR>
<TH COLSPAN=2 BGCOLOR=#FFFFFF><FONT SIZE=-1 FACE=Verdana>User Information</TH>
</TR>
<TR>
<TD BGCOLOR=#FFFFFF><FONT FACE=Verdana size=1>Username:</TD>
<TD BGCOLOR=#FFFFFF><FONT FACE=Verdana><SMALL><INPUT TYPE=TEXT NAME=username SIZE=8 MAXLENGTH=8><font size=1>Only of letters and numbers.</TD>
</TR>
<TR>
<TD BGCOLOR=#FFFFFF><FONT FACE=Verdana size=1>Password:</TD>
<TD BGCOLOR=#FFFFFF><FONT FACE=Verdana><SMALL><INPUT TYPE=TEXT NAME=password SIZE=8 MAXLENGTH=8><font size=1>Only of letters and numbers.</TD>
</TR>

<TR>
<TH COLSPAN=2 BGCOLOR=#FFFFFF><FONT SIZE=-1 FACE=Verdana>Contact Information</TH>
</TR>
<TR>
<TD BGCOLOR=#FFFFFF><FONT FACE=Verdana size=1>Email Address:</TD>
<TD BGCOLOR=#FFFFFF><FONT FACE=Verdana><SMALL><INPUT TYPE=TEXT NAME=email SIZE=30><BR><FONT size=1></TD>
</TR>
<TR>
<TD BGCOLOR=#FFFFFF><FONT size=1 FACE=Verdana>Your First Name:</TD>
<TD BGCOLOR=#FFFFFF><FONT FACE=Verdana><SMALL><INPUT TYPE=TEXT NAME=Fname SIZE=30></TD>
</TR>
<TR>
<TD BGCOLOR=#FFFFFF><FONT size=1 FACE=Verdana>Your Last Name:</TD>
<TD BGCOLOR=#FFFFFF><FONT FACE=Verdana><SMALL><INPUT TYPE=TEXT NAME=LName SIZE=30></TD>
</TR>
<TR>
<TD BGCOLOR=#FFFFFF><FONT size=1 FACE=Verdana>City:</TD>
<TD BGCOLOR=#FFFFFF><FONT FACE=Verdana><SMALL><INPUT TYPE=TEXT NAME=City SIZE=30 MAXLENGTH=20></TD>
</TR>
</TABLE>

<INPUT TYPE=SUBMIT VALUE="Create Account">

</FORM></BODY></HTML>