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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to complete a form automatically?

Status
Not open for further replies.

WebStar

Programmer
May 1, 2002
69
0
0
DE
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.
What I learned so far is that the name/value pairs of inputs can be either encoded directly into the url, like this or encoded into the body of the http request, which encoding to use depends on the method attribute specified in the form element.
How can I tell wich way the site transmites the input values?
Thank you in advance!
 
Webstar,

Have a look at the GET and POST methods for Forms.

There is certain data that is available about the environment on the client side like the user agent (browser type), and screen resolution, but it requires a bit of VBScript, or Javascript to get this sent back to the server.

The privacy of the machine won't allow it send user information without consent from the user, so that's why most sites present a form, and retrieve using named value pairs

If you really want to see what is being transmitted and recieved, put a port scanner on port 80 of the client machine, and see if any of that info is actually what you want.

HTH
--Paul
 
Or use javascript. You can send a query string (the a=b&1=2 format you mention) and then have a javascript function that takes that info and pre-fills the form fields. Its a fairly simple exercise that the javascript forum can help you with.

 
As far as filling in a form with name, address, etc., you'll have to place a cookie on the users machine that contains this info and then read it when they open your form. Yes, you can get some info from the query string but you won't get what you're looking for.

There's always a better way. The fun is trying to find it!
 
What you're wanting is to have some text files on your computer that has personal information common to most registration forms, and to have some way to fill in those form fields automatically, correct? If so, I don't think this is a cgi question. Also, there's already plenty of software out there that'll do this for you, such as or
Or maybe you're making a script to automatically go to web sites and submit the forms on them using your .txt files for information. Then you'd have to get the script to find the form and then get the names of the form fields. Then it just needs to match your info in the .txt files to the appropriate fields in the form and submit those name/value pairs. The form tag on the web page would tell whether they need to be submitted in the url or as part of the http request body (GET or POST). You'll be looking for method=GET or method=POST in the form tag. If the method isn't set explicitly I believe it defaults to GET.

Kevin
A+, Network+, MCP
 
philote the second guess is exactly what I want. I want my cgi to go to a web site and make an acount automatically and is simpler than you said because I know the site and I know the fields. So I don't even have to open IE for that. The method on the site is POST. The thing I don't know is how the body of the message should look since is not a get method to encript the pairs of fields/values in the url.
 
What is the site? Maybe we can have a look and try to help...

Duncan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top