-
filling in forms on a webpage
hey, what i want my program to do is prompt the user for username, email, and password, connect to the website, enter the information into the appropiate fields, and then log in.
i can do everything except for the filling in and logging in part. i've read that i need to use httpconnect(i think) but im still not sure on how to do it. thanks
-
What is your scenario ? What is the action value (url) on your form ? Are you using a servlet ?
eschew obfuscation
-
basically my friend wants me make a program that will log into the website for him automatically.
for action value, do you mean something like this:
<form action="login.php" method="post">
or like this:
<td align="center"><input class="login_input" type="text" name="usrname" value=""></td>
i dont think i'll be using a servlet mainly because i dont know what that is =P lol.
-
I mean both, the input tags' values will be submitted together with the form and processed by whatever script (php, perl/cgi, servlet) that receives it at the server side.
Automatic login, like you want, is handled by the server that can use cookies from the users last session for autentication.
i dont think i'll be using a servlet mainly because i dont know what that is =P lol.
hehe, then I think you may have jumped in at the deep end here...
Last edited by sjalle; 01-18-2006 at 07:10 PM.
eschew obfuscation
-
oh well...this will be a fun learning experience for me. im mainly trying things that are a little too advanced for me because in my ap comp science class we are basically relearning c++ except with java syntax..wooo lol.
and if it helps at all the site for which my friend wants to make him an autologin for is
www.kingsofchaos.com
i know it can be done with a simple html file, but i want to try it through a programming language.
-
Fun... well. Remember, the login script expects a form and you can't change that. And it is using cookies or session data to verify that the client is logged in, and it will check this every time you click a submit button on the site. Your program will have to deal with this, then it will have to dive into the web browsers inner file domains on the client side and store the cookies/session data, and then it will have to open the web browser.....
i know it can be done with a simple html file
You mean login using your own homemade html file that is not delivered by server ?... How ?
It seems that the task you are working on is: making a web browser (shudder) 
Best of luck to you !
Last edited by sjalle; 01-18-2006 at 06:21 AM.
eschew obfuscation
-
for an html file it wouldnt be hard at all...
<html>
<body onload="document.forms['Form'].submit();">
<form method="post" name="Form" action="http://www.kingsofchaos.com/login.php">
<input type="hidden" name="usrname" value="USERNAME"></br>
<input type="hidden" name="uemail" value="E-MAIL"></br>
<input type="hidden" name="peeword" value="PASSWORD">
</form>
</body>
</html>
filling in USERNAME, E-MAIL, and PASSWORD with the correct account information.
that will work...so im not sure why this should be so hard
-
hey, what i want my program to do is prompt the user for username, email, and password, connect to the website, enter the information into the appropiate fields, and then log in.
Ok, then what you can do is make an application that prompts for these parameters, writes an html file like the one above, instantiates a Runtime instance and launches a web browser with the newly created html file as a startup parameter.
This is not exactly what your initial quest was, and the setup I have described here is what we norwegians call "crossing the river to get a bucket of water", but hey, it is a nice little java lecture nevertheless. 
Btw what i said here:
There is no way for you to make a form yourself and submit that to the server from your client browser, - you get the form from the server, fill it in, and submit it back to the server. What you want requires webmaster access to the server.
...is crap, the setup will work if these parameters are all that is needed.
eschew obfuscation
-
lol...hm is there any way that i could do it without loading the actuall browser?
such as just connecting to the website through the program by using something like:
URL url = new URL("http://www.kingsofchaos.com");
URLConnection connection = url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
for(int i = 0; i < 20; i++)
{
line = in.readLine();
System.out.println(line);
}
this is just for reading the source code from the website, but i have yet to figure out how to write to it and then log in.
-
Getting the data from a server is plain stuff, sending data to the server is quite a different ballgame. I just posted a reply at JGuru:
http://www.jguru.com/forums/view.jsp?EID=1278911
Check out the MixedRequestHandler class, it will give you some idea of what the server expects to receive when a form is submitted. The thing is, no matter what you do client side, you will have to talk to a server script that expects a form.
eschew obfuscation
Similar Threads
-
By William R. Cousert in forum .NET
Replies: 2
Last Post: 02-21-2002, 05:28 AM
-
By Dave in forum VB Classic
Replies: 0
Last Post: 12-06-2001, 03:26 PM
-
By Monte Hansen in forum VB Classic
Replies: 2
Last Post: 12-06-2001, 03:26 PM
-
By Barend Esterhuizen in forum VB Classic
Replies: 1
Last Post: 06-16-2000, 04:39 AM
-
By Ashu Mahajan in forum Web
Replies: 0
Last Post: 03-30-2000, 01:53 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks