Results 1 to 1 of 1
Thread: Allow input through browser
- 05-19-2010, 05:50 PM #1
Member
- Join Date
- May 2010
- Posts
- 3
- Rep Power
- 0
Allow input through browser
I'm using a public api for Xanga to post blog entries. However, there's a step between getting the pretoken and getting the token, in which the
To get a token (which must be POSTED for every action besides logging in and getting a pretoken), I had to:
- run the program to get a pretoken
- use the pretoken as GET data to open a web page (in a browser)
- indicate that I allow this action by clicking an "accept" button on an html form in the browser (this is also the login step.)
- after indicating my consent by manually interfacing with the web page, the pretoken can be used to get an actual token. So I run the program again, using the pretoken to get a token
Of course, you see the problem. I'm manually running the program, then running it again. That's not very automated. Of course, I could put the thread to sleep for a few seconds while I perform the task on the browser page, but that's downright inelegant.
What I'd like is for the java program to know what happens on the browser. I imagined that I could just tap into the browser's output, along the lines of:
However, when I try to read that stream, I don't get anything at all.Java Code:Process process = Runtime.getRuntime().exec([I][browser][/I] -url [I][url][/I]); InputStream in = process.getInputStream(); InputStreamReader reader = new InputStreamReader(in); int i; while ((i = reader.read()) != -1)[INDENT]System.out.print((char) i);[/INDENT]
Can anyone think of an alternative solution?
Similar Threads
-
Web Browser
By rp181 in forum Advanced JavaReplies: 6Last Post: 04-20-2010, 06:59 PM -
Input technique for unknown lines of input
By ducreative in forum New To JavaReplies: 16Last Post: 09-23-2009, 09:26 AM -
SWT browser help
By MarkWilson in forum SWT / JFaceReplies: 1Last Post: 04-07-2009, 10:56 AM -
Need Help! swt/Browser
By sealyu in forum SWT / JFaceReplies: 4Last Post: 07-09-2008, 08:16 PM -
how to take input and verify input in Java programs
By bilal_ali_java in forum Advanced JavaReplies: 0Last Post: 07-21-2007, 08:46 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks