469,275 Members | 1,818 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

how to get data from webpage

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
3 13276
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
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
- 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.

Similar topics

2 posts views Thread by Joey Martin | last post: by
1 post views Thread by teknowbabble | last post: by
4 posts views Thread by news.microsoft.com | last post: by
5 posts views Thread by John Bradley | last post: by
6 posts views Thread by shivavrata | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.