How can I extract information from a web page

I wanna read some information from a webpage, and then put those information together into a table. Since I only know the url, not the file path, when I use BufferedReader(new FileReader(FilePath)), there is a FileNotFoundException. How can I do that? Thanks a lot.

You can do it in following way....
First you need to create the object of URL by specifying the URL name.
URL myurl = new URL("http://www.xyz.com/index.html"); //specify your URL path here
URLConnection conn = null;
DataInputStream data = null;
String line;
StringBuffer buf = new StringBuffer();
try {
conn = myurl.openConnection();
conn.connect();
data = new DataInputStream(new BufferedInputStream(
conn.getInputStream()));
while ((line = data.readLine()) != null) {
buf.append(line + "\n");
data.close();
catch (IOException e) {
System.out.println("IO Error:" + e.getMessage());
So, at the end, you have the data in your string buffer...you can use it wherever u want.
Hope this helps

Similar Messages

  • How can I extract information from an IdM approval stack?

    During the workflow for provisioning employees, managers are required to authorize certain actions. The problem is that they sometimes do not.
    My boss has asked for a formatted report in ascending date order that shows the passive authorizations (some are weeks old!) and the managers to whom the "lazy" managers report.
    I've done this, but it's driven by my manually screen-scraping the information from the approval list onto an external file.
    The problem is that I have to initiate the process by bringing up the approval screen, copying and pasting information into a file and then running a Perl munge script against the created file...
    I want to be able to acccess the approvals list by means of a crontab initiated script and not have to rely on the "screen-scrape."
    Any ideas?
    Ian Clark
    ADP - ProBusiness.
    Message was edited by:
    Namalankula

    You can do it in following way....
    First you need to create the object of URL by specifying the URL name.
    URL myurl = new URL("http://www.xyz.com/index.html"); //specify your URL path here
    URLConnection conn = null;
    DataInputStream data = null;
    String line;
    StringBuffer buf = new StringBuffer();
    try {
    conn = myurl.openConnection();
    conn.connect();
    data = new DataInputStream(new BufferedInputStream(
    conn.getInputStream()));
    while ((line = data.readLine()) != null) {
    buf.append(line + "\n");
    data.close();
    catch (IOException e) {
    System.out.println("IO Error:" + e.getMessage());
    So, at the end, you have the data in your string buffer...you can use it wherever u want.
    Hope this helps

  • How can you copy information from Safari into Pages

    Is there a way to easily copy data, such as financial tables from Safari into Pages and maintain the integrity of the table and the data within it?  When I copy and paste it comes out all misaligned and into multiple pages.  The same thing happens if I try to highlight the table in Safari and drag it into Pages.  Is there not a "paste special" function in Pages like there is in Microsoft??

    See:
    http://support.apple.com/kb/HT5775
    You can then drag the resulting image into a Pages document, and position.
    Ernie

  • How can I extract images form other web pages with an applet?

    Hello
    I have a problem
    Here is my code
    import java.net.*;
    import javax.swing.*;
    import java.awt.image.*;
    public class Cursbnr extends JApplet{
    public JLabel EuroValue =new JLabel();
         public JLabel DolarValue =new JLabel();
         public JLabel GoldValue =new JLabel();
         JPanel EuroBar = new JPanel();
         JPanel DolarBar = new JPanel();
         JPanel GoldBar = new JPanel();
         Image EuroImg=null;
         Image DolarImg=null;
         Image GoldImg=null;
         try{          
              EuroImg = this.getImage(new URL("http://www.bnro.ro/Images/Flags/eur.gif"));
              DolarImg = this.getImage(new URL("http://www.bnro.ro/Images/Flags/usd.gif"));
              GoldImg = this.getImage(new URL("http://www.bnro.ro/Images/Flags/xau.gif"));
    catch (MalformedURLException e) {
         System.err.println(e);
    When I run this applet whith eclipse it's working, but when I put the class file into a html and I ran the html it's not working
    What can I do?

    Duplicate of this post, reply there: http://forum.java.sun.com/thread.jspa?threadID=670274&messageID=3918814#3918814

  • How can I transfer information from one ipad to another?

    how can I transfer information from one ipad to another ?

    What kind of information? You can sync things like Contacts and Calendars by using iCloud. You can backup one iPad to iTunes on a computer and then sync the backup to the other iPad. You can configure your iTunes content and sync the same content to both iPads.
    It is based on what you want to do. Or are you looking for a way to send files from one iPad to another wirelessly? There are apps to do things like that, as well as cloud services, such as DropBox.

  • HT201250 how can i pass information from one mac to another mac by using the time capsule

    how can i pass information from one mac to another mac by using the time capsule

    If you want to transfer files, settings, etc., you must open Migration Assistant (Applications > Utilities) in the Mac that you want to transfer the files and follow the instructions

  • HT2646 How can I stream information from my pc through the apple tv box to my television

    How can I stream information from my pc through the apple tv box to my TV

    If you want to mirror you will need to use something like Airparrot

  • How can i extract data from oracle table  to flat file or excel spread shee

    Hello,
    DB Version is 10.1.0.3.0
    How can i extract data from oracle table to flat file or excel spread sheet by using sub programs?
    Regards,
    D

    Here what I did
    SET NEWPAGE 0
    SET SPACE 0
    SET LINESIZE 80
    SET PAGESIZE 0
    SET ECHO OFF
    SET FEEDBACK OFF
    SET VERIFY OFF
    SET HEADING OFF
    SET MARKUP HTML OFF SPOOL OFF
    Sql> SPOOL bing
    select * from -------;
    SPOOL OFF;
    I do not see file.
    I also tried
    Sql> SPOOL /tmp/bing
    select * from -------;
    SPOOL OFF;
    But still not seeing the fie,

  • How can I extract image from complex (multycoloured0 background?

    How can I extract image from complex (multycoloured) shot?

    I would say either using the pen tool or the quick mask tool but without seeing how complex the image/background is I can't give you a complete answer...?
    Can you post the image?

  • How can I extract photos from my backup (5000+ photos) for free?

    How can I extract photos from my backup (5000+  photos) for free?

    eyal123 wrote:
    How can I extract photos from my backup (5000+  photos) for free?
    You cannot.
    Why are you opposed to paying for some software to help do what you want?
    You can restore the backup to your iPhone then sync the photos to your computer.

  • HT3275 how can i retrieve information from  time machine if my computer has less storage capacity? How can I access data that is on my time machine but can not be copied to a computer with less storage capacity? I used to have 180 GB, now I have 128 GB.

    how can i retrieve information from  time machine if my computer has less storage capacity? How can I access data that is on my time machine but can not be copied to a computer with less storage capacity? I used to have 180 GB, now I have 128 GB.

    Plug an external drive into the computer and use that to expand data onto.
    http://pondini.org/TM/16.html

  • HT204053 how can i move information from mobileme to icloud/

    how can i move information from mobileme to icloud

    MobileMe has closed, it is no longer possible to get data from it.

  • Extracting info from a web page

    Hi,
         I m not sure if i m asking this question at the right forum.
    Can anyone tell me if there is a way to extract data from a web page.
    This means, say for example a web site Yahoo displays stock quotes
    updated or NASDAQ values almost in real time.
    Now if i want to get that information from the web page into one
    of my applications ,say, something that uses that data. Is there
    a way to do it?
    Just curious

    Yes, it's possible. You can use the java.net.URL object to connect to websites and download the html. Doing the coding is not that easy, and you should also be mindful of not redistributing data you've gotten from another site without permission

  • Meta data information from dynamic web page

    Dear all,
    for website searching, we should put the meta data in every page, in my case
    i have to get the data from dynamic page(data are coming from database).
    So, how can i meta data information from dynamic web page
    kindly suggest.
    thanx,
    R. Ramasubramanaim.

    Build your web application with BSP, that's all I can say...

  • How can i see visitor statistics for web page hosted on osx lion server

    Hello
    how can i see visitor statistics for web page hosted on osx lion server
    Thanks
    Adrian

    Just click inside the url address bar. Full url address highlighted, will appear.
    Best.

Maybe you are looking for

  • Scanning multiple pages with preview and brother MFC-7440n

    Hi, because of some problems with my old scanner after i installed snow leopard, i bought a new compatible one. It's a brother MFC-7440n with apple build-in drivers. When i start scanning to preview with more than one page, there will be a pdf docume

  • NEED QUICKTIME 7.5.5 or later. help

    i havent been able to use itunes for like a month or so now because everytime i click on it it tells me i need quicktime 7.5.5 or later. but when i go to look for it and download it i always download the wrong one. cant find the right one.

  • How does Apple process Raw Photo's for Books?

    Shooting in Raw I recently made up an 80 page book, all of Raw photo's about 7meg each. However the PDF File that was uploaded to Apple was only 20megs in total. So a massive compression was used. This surely happens every time. If so is there any po

  • Error in Data Loading - 0Base_UOM

    Hi all, I hv received an error while loading data in BW MM-INV cube. Error is .. Record1 : Error Calling number range object 0Base_UOM dimension DU (). System is picking UOM as NO while it is NOS in R/3 up to extract structure. While rest of UOM syst

  • Problems after new software install - 5800

    Yesterday I installed software v 40.0.005 to my 5800 Music Express and I have found a few issues that I cannot seem to resolve: 1 - The appearance of the stop/snooze buttons for the Alarm Clock changed, but the stop button no longer works.  Although