View Full Version : Using vb to fill out an html web form?
01-18-2005, 04:59 AM
Im trying to make a program that logs into a broswer based game and then buys the weapons and such that you tell it to, the first thing I need to figure out tho is how to log in. I have searched google for several hours but have found nothing of use, the only site that I found of some use I forgot and cant find again, even then it was kinda of vague. So if anyone could help me out or point me in the right direction for my work your help is appreciated. I would prefer any help that is given to be relevant to Vb 6 but if it is a must I can do with vb.net.
EDIT: Heh i guess i forgot to tell what exactly im trying to do, im trying to have the program find the web form within the page of the site and fill out the forms with the user provided data like the username and password.
01-18-2005, 09:35 AM
You would need to make a request to the login page, save the body of the response into a string and then parse that string looking for the login form. That would mean searching the string for the location of the form tag. Then you should parse that form to see what are the input fields and make another http request to send the data to the server (using a POST request). You can check out the specifications for http requests and responses here (http://www.ietf.org/rfc/rfc2616.txt) to find out how the requests should be formatted. You could try to use an existing XML parser to do the parsing for you, but since web pages are hardly ever valid XML, the parser might have some trouble with that (choosing an open source parser that you can modify might help you out in this case).
Of course, instead of doing all the parsing in the program, you could just manually download the page, view the source and create a POST request based on that (using the http reference on the link above), but in this case you would have to go through the process again if they change the page a little.
01-18-2005, 04:34 PM
heh, Talk about ALOT of reading but is this what your talking about
The POST method is used to request that the origin server accept the
entity enclosed in the request as a new subordinate of the resource
identified by the Request-URI in the Request-Line. POST is designed
to allow a uniform method to cover the following functions:
- Annotation of existing resources;
- Posting a message to a bulletin board, newsgroup, mailing list,
or similar group of articles;
- Providing a block of data, such as the result of submitting a
form, to a data-handling process;
- Extending a database through an append operation.
The actual function performed by the POST method is determined by the
server and is usually dependent on the Request-URI. The posted entity
is subordinate to that URI in the same way that a file is subordinate
to a directory containing it, a news article is subordinate to a
newsgroup to which it is posted, or a record is subordinate to a
The action performed by the POST method might not result in a
resource that can be identified by a URI. In this case, either 200
(OK) or 204 (No Content) is the appropriate response status,
depending on whether or not the response includes an entity that
Hows that relate to Vb?
01-19-2005, 09:55 AM
And also section 4 that describes the format of an http message.
It has nothing to do with VB per se, but it has everything to do with what you are trying to accomplish. You want to interact with a web page. This web page "communicates" with your computer using the http protocol. So you need to use VB (or any other language, it doesn't really matter) to construct http messages (lucky for you http is a plain text format so it shouldn't be to hard), and send those to the web site's IP. The web site won't know the difference and react the same way as if you were accessing it through a regular browser, since what a browser does is also making http requests to the web site's IP.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.