By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,542 Members | 1,097 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,542 IT Pros & Developers. It's quick & easy.

how to get data from webpage

P: n/a
yy
hi~~

I wanna write a java program that can get data from a webpage...
There are some figures frequently updated on the web...
I want to get the latest data and do some calculation, but I have no
ideas on how to get the data and how to know there is update on the
web

please help~~

thanks a lot!
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
try looking at the URL class

"yy" <pi********@yahoo.com.hk> wrote in message
news:71************************@posting.google.com ...
hi~~

I wanna write a java program that can get data from a webpage...
There are some figures frequently updated on the web...
I want to get the latest data and do some calculation, but I have no
ideas on how to get the data and how to know there is update on the
web

please help~~

thanks a lot!

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.732 / Virus Database: 486 - Release Date: 7/29/2004
Jul 17 '05 #2

P: n/a
hi,

This can be done in perl

use LWP::Simple;
$htmlpage = get($url);

In java

URL url = new URL("$url");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
BufferedReader rd = new BufferedReader(new InputStreamReader
(conn.getInputStreamReader());

String line;
while(line=rd.readLine() != null) {
response += line;
}
The html page will be now available in the response String. This
String can then be used with the regex to solve according to our
requirement.

Hope that helps you.

Giridhar Nandigam.

pi********@yahoo.com.hk (yy) wrote in message news:<71************************@posting.google.co m>...
hi~~

I wanna write a java program that can get data from a webpage...
There are some figures frequently updated on the web...
I want to get the latest data and do some calculation, but I have no
ideas on how to get the data and how to know there is update on the
web

please help~~

thanks a lot!

Jul 17 '05 #3

P: n/a
- Have a look at HttpClient :
http://jakarta.apache.org/commons/httpclient

- The response header 'last-modified' will give you the last
modification date of the page.

pi********@yahoo.com.hk (yy) wrote in message news:<71************************@posting.google.co m>...
hi~~

I wanna write a java program that can get data from a webpage...
There are some figures frequently updated on the web...
I want to get the latest data and do some calculation, but I have no
ideas on how to get the data and how to know there is update on the
web

please help~~

thanks a lot!

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.