Results 1 to 7 of 7
Thread: java
- 08-10-2009, 08:07 PM #1
Member
- Join Date
- Aug 2009
- Posts
- 32
- Rep Power
- 0
java
Hey,
Is it possible (it always is, the question is how :)
to get a file from internet, read the string, cut it in pieces, open your browser with a link wherein the cutted string is
All those in 1 second?
I don't need a whole script (although it would always be nice :)
but just some function-names that I will need to do this.
- 08-10-2009, 09:42 PM #2
Senior Member
- Join Date
- Sep 2008
- Posts
- 564
- Rep Power
- 5
sorry, but you lost me when you said "cut it in pieces" and everything beyond it.
from what i can tell, you want to read html from an url, parse html, and execute an external program with parameters.
using those terms on search engines, you should be able to find a lot of useful info on the internet, if not at least have good starting points.
- 08-11-2009, 01:47 AM #3
You can use a URL object and a stream reader to read a web page.
You can use Java's REGEX package to scrape information from said page.
You can then use Java's Process object to start a native app with parameters.
- 08-11-2009, 09:09 AM #4
Member
- Join Date
- Aug 2009
- Posts
- 32
- Rep Power
- 0
Thanks quad64bit, I will try it out :),
I will it explain with an example for you emceenugget :)
if you open:
example.be/example.php
you see:
text: "This is the text"
you need to send:
This is the text
to
example.be/validate.php?text=This is the text
All in 1 second, got it?
Kruptein
- 08-11-2009, 09:31 AM #5
Member
- Join Date
- Aug 2009
- Posts
- 32
- Rep Power
- 0
Thanks quad64bit, I will try it out :),
I will it explain with an example for youemceenugget :)
if you open:
example.be/example.php
you see:
text: "This is the text"
you need to send:
This is the text
to
example.be/validate.php?text=This is the text
All in 1 second, got it?
I know have this:
this gave me an output with forms and logins, although there is only one thing written on that page: the "letters" are: 'example'Java Code:try { // Create a URL for the desired page URL url = new URL("site"); //I couldn't write a url because I haven't 20 posts yet // Read all the text returned by the server BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String str; while ((str = in.readLine()) != null) { System.out.println(str); } in.close(); } catch (MalformedURLException e) { } catch (IOException e) { }
What have I done wrong?
Kruptein
- 08-11-2009, 10:55 AM #6
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
that page check login
you need to login the website before access
- 08-11-2009, 11:14 AM #7
Member
- Join Date
- Aug 2009
- Posts
- 32
- Rep Power
- 0
How do I
a) avoid it
b) solve it (I'm a member of the site so I can login)
With solv'it I mean:
a) Login via java and then do the action I want to do in first place
b) Only do the action I want to do, but tell a way that I only have to login in my browser or something like that
thanks for your fast reply!


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks