How to read data from a website based on user inputs through java programmi

Hi
I want to get information from a website based on some inputs that I have. The inputs change everytime and based on them, different output is expected. How do I go about with it? Please advice...
Will data mining help in this? or is it used only for analysis and predictions?

you can get the webpage you need very simply like this :
Test.java
public class Test{
          public static void main(String[] args) {
               URLClient client = new URLClient();
                        // URL of a webpage
               String webPage = client.getDocumentAt("http://content-ind.cricinfo.com/slvind/engine/current/match/343730.html?template=desktop;view=main;wrappertype=desktop");
               System.out.println(webPage);
     }URLClient.java
     import java.net.*;
     import java.io.*;
     public class URLClient {
          protected URLConnection Connection;               
               public String getDocumentAt(String urlString) {
                         StringBuffer document = new StringBuffer();
                         try {
                                        URL url = new URL(urlString);
                                        URLConnection conn = url.openConnection();
                                        BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                                        String line = null;
                                        while ((line = reader.readLine()) != null)
                                             document.append(line + "\n");
                                        reader.close();
                                   } catch (MalformedURLException e) {
                                   System.out.println("Unable to connect to URL: " + urlString);
                                   } catch (IOException e) {
                                   System.out.println("IOException when connecting to URL: " + urlString);
                              return document.toString();
          }

Similar Messages

  • How to read data from a website

    Hello Everyone..
    I hav a interesting scanario..
    Is it possible to read data from a website..!!!
    My scenario is to read a bank statement from a banks website(internet banking)..
    using the same authentication my application must be able to pull the data from the website and update my r3...
    Please crack this out for me..
    Awaiting for solution..
    Thanks in advance

    check whether the bank offers webservice to get this data, if yes either from ABAP of JAVA you can consume this webservice to get the bank statement.
    else
    from abap you can use cl_http_client to make your ABAP to act as http client to read data from that website. (search weblog and ABAP forums for cl_http_client - there are lot of examples)
    Regards
    Raja

  • How to display data from a recordset based on data from another recordset

    How to display data from a recordset based on data from
    another recordset.
    What I would like to do is as follows:
    I have a fantasy hockey league website. For each team I have
    a team page (clubhouse) which is generated using PHP/MySQL. The one
    area I would like to clean up is the displaying of the divisional
    standings on the right side. As of right now, I use a URL variable
    (division = id2) to grab the needed data, which works ok. What I
    want to do is clean up the url abit.
    So far the url is
    clubhouse.php?team=Wings&id=DET&id2=Pacific, in the end all
    I want is clubhouse.php?team=Wings.
    I have a separate table, that has the teams entire
    information (full team name, short team, abbreviation, conference,
    division, etc. so I was thinking if I could somehow do this:
    Recordset Team Info is filtered using URL variable team
    (short team). Based on what team equals, it would then insert this
    variable into the Divisional Standings recordset.
    So example: If I type in clubhouse.php?team=Wings, the Team
    Info recordset would bring up the Pacific division. Then 'Pacific'
    would be inserted into the Divisional Standings recordset to
    display the Pacific Division Standings.
    Basically I want this
    SELECT *
    FROM standings
    WHERE division = <teaminfo.division>
    ORDER BY pts DESC
    Could someone help me, thank you.

    Assuming two tables- teamtable and standings:
    teamtable - which has entire info about the team and has a
    field called
    "div" which has the division name say "pacific" and you want
    to use this
    name to get corresponding details from the other table.
    standings - which has a field called "division" which you
    want to use to
    give the standings
    SELECT * FROM standings AS st, teamtable AS t
    WHERE st.division = t.div
    ORDER BY pts DESC
    Instead of * you could be specific on what fields you want to
    select ..
    something like
    SELECT st.id AS id, st.position AS position, st.teamname AS
    team
    You cannot lose until you give up !!!
    "Leburn98" <[email protected]> wrote in
    message
    news:[email protected]...
    > How to display data from a recordset based on data from
    another recordset.
    >
    > What I would like to do is as follows:
    >
    > I have a fantasy hockey league website. For each team I
    have a team page
    > (clubhouse) which is generated using PHP/MySQL. The one
    area I would like
    > to
    > clean up is the displaying of the divisional standings
    on the right side.
    > As of
    > right now, I use a URL variable (division = id2) to grab
    the needed data,
    > which
    > works ok. What I want to do is clean up the url abit.
    >
    > So far the url is
    clubhouse.php?team=Wings&id=DET&id2=Pacific, in the end
    > all
    > I want is clubhouse.php?team=Wings.
    >
    > I have a separate table, that has the teams entire
    information (full team
    > name, short team, abbreviation, conference, division,
    etc. so I was
    > thinking if
    > I could somehow do this:
    >
    > Recordset Team Info is filtered using URL variable team
    (short team).
    > Based on
    > what team equals, it would then insert this variable
    into the Divisional
    > Standings recordset.
    >
    > So example: If I type in clubhouse.php?team=Wings, the
    Team Info recordset
    > would bring up the Pacific division. Then 'Pacific'
    would be inserted into
    > the
    > Divisional Standings recordset to display the Pacific
    Division Standings.
    >
    > Basically I want this
    >
    > SELECT *
    > FROM standings
    > WHERE division = <teaminfo.division>
    > ORDER BY pts DESC
    >
    > Could someone help me, thank you.
    >

  • How to read data from a zipped MS Access file?

    How to read data from a zipped MS Access file?

    RPJ,
    You do not need to use the Close Zip File.vi when you unzip a folder.  This VI is used when you are creating a zip folder.
    As for examples, I found a couple of ActiveX based MS Access examples.  These programs look to be pretty basic.  For more in depth example I would search Microsoft Developers Network
    http://zone.ni.com/devzone/cda/epd/p/id/2188
    http://zone.ni.com/devzone/cda/epd/p/id/1694
    Regards,
    Jon S.
    National Instruments
    LabVIEW R&D

  • How to read data from a CLUSTER STRUCTURE not cluster table.

    Hi,
    how to read data from a CLUSTER STRUCTURE not cluster table.
    regards,
    Usha.

    Hello,
    A structre doesnt contain data.. so u cannot read from it. U need to find out table of that structure and read data from it.
    Regards,
    Mansi.

  • How to read data from a file that was formatted by excel?

    Hi everyone, I'm familiar with java.io and the ability to read from files, can anyone tell me how to read data from a file that was formatted by excel? Or at least give me some web references so that I can learn about it?

    http://jakarta.apache.org/poi/hssf/index.html
    HSSF stands for Horrible Spreadsheet Format, but it still works!

  • How to read data from a router by using labview

    I am a  beginner labview. How to read data from a router by using labview ? 

    What kind of data are you trying to read?
    Does the router behave like a webserver that you log into?  If so, search the forums for threads discussing HTML.

  • How to read data from a connected modem

    any one can help me? how to read data from a connected modem. The modem received real-time data from other server. The data is in text format. I can see this text when I used hyperterminal for dial up and the data is accumulated such as:
    @aa1235678
    @bb2135647
    @cc5214367
    since it is real-time data, I want to read one line each time instantly when it arrives.

    You need to use the Java Communications API. (http://java.sun.com/products/javacomm/index.html)

  • How to read data from an internal table into a real table?

    Hello experts,
    I'm relatively new to ABAP and I'm trying to figure out how to read data from an internal table into a table that I created.  I'm trying to use the RRW3_GET_QUERY_VIEW_DATA function module to read data from a multiprovider.  I'm trying to read data from the e_cell_data and e_axis_data tables into a table that I've already created.  Please see code below.
    TABLES MULTITAB.
    DATA:
      query_name TYPE RSZCOMPID,
      s_cubename TYPE RSINFOPROV,
      t_cell_data TYPE RRWS_T_CELL,
      t_axis_data TYPE RRWS_THX_AXIS_DATA,
      t_axis_info TYPE RRWS_THX_AXIS_INFO,
      wa_t_cell_data like line of t_cell_data,
      wa_t_axis_data like line of t_axis_data,
      w_corp_tab like line of t_cell_data.
    s_cubename = 'CORP_MPO1'.
    query_name = 'Z_corp_test'.
        CALL FUNCTION 'RRW3_GET_QUERY_VIEW_DATA'
           EXPORTING
             i_infoprovider           = s_cubename
             i_query                  = query_name
            i_t_parameter            = query_string_tab
           IMPORTING
             e_cell_data              = t_cell_data
             e_axis_data              = t_axis_data
             e_axis_info              = t_axis_info.
    If anyone has any information to help me, I would greatly appreciate it.  Thanks.

    Hi,
    <li>Once you call the function module RRW3_GET_QUERY_VIEW_DATA, lets say data is available in the corresponding tables e_cell_data e_axis_data which you have mentioned.
    <li>Modify your internal table defined for other purpose, with data from e_cell_data e_axis_data like below.
    LOOP AT t_cell_data INTO wa_t_cell_data.
      "Get the required data from t_cell_data.
      MOVE-CORRESPONDING wa_t_cell_data TO it_ur_tab.
      "Modify your internal table wih data
      MODIFY it_ur_tab TRANSPORTING <field1> <field2> <field3>.
    ENDLOOP.
    LOOP AT t_axis_data INTO wa_t_axis_data.
      "Get the required data from t_cell_data.
      MOVE-CORRESPONDING wa_t_axis_data TO it_ur_tab.
      "Modify your internal table wih data
      MODIFY it_ur_tab TRANSPORTING <field1> <field2> <field3>.
    ENDLOOP.
    Thanks
    Venkat.O

  • Help me,  How to read data from USB ???

    Help me, How to read data from USB ???

    If its a disk on key or some portable hard drive than once its connected to the usb and recognized by the system you can access it through java like you would access your hard drive.

  • JTable, how to read Data from it when enter is pressed

    How to read Data from JTable on Return or lost focus from cell.
    Also please tell me which listener I should should.
    thx for help

    You should read the tutorial about tables, cell editors and models.
    Also you should not [url http://forum.java.sun.com/thread.jsp?thread=472677&forum=57&message=2186815]crosspost
    Mike

  • How to retrieve data from other websites?

    Hi all,
    Don't know if anyone can point me in the right direction.
    How can I retrieve or fetch data from other website&rsquo;s (*Database*) ?
    I&rsquo;m trying to build a web application that would retrieve and fetch data from other website&rsquo;s (Database) like the www.comparethemarket.com.
    The data I&rsquo;m trying to fetch it is in database, in my opinion I think I have to make a http web request then send parameters, then get the result. I could not find any tutorials
    on the web,
    Thank you.

    Fahad_24 wrote:
    Hi all,
    Don't know if anyone can point me in the right direction.
    How can I retrieve or fetch data from other website&rsquo;s (*Database*) ?
    I&rsquo;m trying to build a web application that would retrieve and fetch data from other website&rsquo;s (Database) like the www.comparethemarket.com.
    The data I&rsquo;m trying to fetch it is in database, in my opinion I think I have to make a http web request then send parameters, then get the result. I could not find any tutorials
    on the web,
    Thank you.Unless the website provides an interface to their data, you are most likely not even allowed to do this. There is only one way to find out: contact them and ask about it or look around their website if their is a manual that describes how to do it. If there is such an interface, it will usually be some kind of web service (such as a SOAP interface).

  • How to fetch data from CDHDR Table based on Order Number

    Hi,
    I need to fetch the data from CDHDR just based on the Order number .I found there is a field called 'OBJECTID' in table 'CDHDR'. But the  last part of OBJECTID contains order number.suppose my order number is 90506210 the objectid field contains '51030000090506210'.510 is login client,don't know what 30 is and last part is order number i.e 000090506210.i have to concatenate all and fetch data .i can do it for one order number but here order number is declared as select-options.how do i ?
    HERE IS THE CODE FOR ONE ORDER NUMBER.HOW CAN DO FOR RANGE OF ORDER NUMBERS.
    PARAMETER : S_OBJECT FOR  /BEV1/RBVBAK-AUFNR  OBLIGATORY.
    DATA : IT_CDHDR TYPE STANDARD TABLE OF CDHDR WITH HEADER LINE,
                 WA_CDHDR LIKE LINE OF IT_CDHDR,
                 S_OBJECT1 LIKE CDHDR-OBJECTID.
    CONCATENATE  sy-mandt  '30'  S_OBJECT INTO S_OBJECT1.
    SELECT * FROM CDHDR INTO TABLE IT_CDHDR WHERE OBJECTID = S_OBJECT1.

    P838355 wrote:>
    > Hi,
    >  I need to fetch the data from CDHDR just based on the Order number .I found there is a field called 'OBJECTID' in table 'CDHDR'. But the  last part of OBJECTID contains order number.suppose my order number is 90506210 the objectid field contains '51030000090506210'.510 is login client,don't know what 30 is and last part is order number i.e 000090506210.i have to concatenate all and fetch data .i can do it for one order number but here order number is declared as select-options.how do i ?
    >
    > HERE IS THE CODE FOR ONE ORDER NUMBER.HOW CAN DO FOR RANGE OF ORDER NUMBERS.
    >
    >
    > PARAMETER : S_OBJECT FOR  /BEV1/RBVBAK-AUFNR  OBLIGATORY.
    >
    > DATA : IT_CDHDR TYPE STANDARD TABLE OF CDHDR WITH HEADER LINE,
    >              WA_CDHDR LIKE LINE OF IT_CDHDR,
    >              S_OBJECT1 LIKE CDHDR-OBJECTID.
    >
    > CONCATENATE  sy-mandt  '30'  S_OBJECT INTO S_OBJECT1.
    >
    > SELECT * FROM CDHDR INTO TABLE IT_CDHDR WHERE OBJECTID = S_OBJECT1.
    You need to loop through the select option and concatenate with required data then select using 'in' instead of equal or select one by one.
    or
    select sales order numbers from VBAK for the selection into internal table then loop through the internal table and concatenate then select from CDHDR.
    for better performance use objectclass in where clause. the value for sales order for objectclass is VERKBELEG.
    in my system the object id is just an order number there is no other additions to it but in CDPOS the tabkey contains the order number with client and other information also.
    the 30 may be your item number... check it
    go ahead and change sales order and see what you can find in CDHDR
    Good luck
    Edited by: Sampath Kumar on Oct 21, 2009 9:02 AM

  • How to read data from a file in OSB

    hi guys,
    Recently, I've got a problem with reading file from specific location. I've actually followed this post OSB 11g - Read or Poll File in OSB - Oracle Fusion Middleware Blog, and then
    I know how to read a file. However, it does not as expected. Because, I've found no way to read data from the file. Therefore, no chance to manipulate the data like assigning to a variable, or extracting ....
    Hence, is there any way to read data from file by using proxy service in OSB ??? No Java code ???
    by the way, supposed that there is no way to read data from a file in OSB. So, What purposes will the way in the post above be used for?
    Many thanks in advance

    http://jakarta.apache.org/poi/hssf/index.html
    HSSF stands for Horrible Spreadsheet Format, but it still works!

  • How to Read Data from a table (horizontal axsis) in an existing report

    Hi to all,
    I've a question. I must read the data in a table of an existing report. I develope with BO XI 3.0
    I don't know how to reach the table in my report from SDK.
    this is my code:
    reports = document.getReports();
    rep = reports.getItem(0);     
    the report has the title and a table horizontal axsis.
    I must read the column name(header column) of the table and all rows for retrieving values.
    Thank u in advance for your attention.

    hi ChinMay,
    thank u for your answer.
    I would like to ask u if Ireport refers crystal reports, while i mean to read data from a webi report.
    I've tried in many manners to read this data and i've read the SDK, but i'm unable to reach the table of my report for reading its rows. i'm able to export in XML format, i'm able to get reportelement , block, but in the java's example of SDK its not present how to obtain the reportbody and subsequently the section or directly a table. the example that i've seen show that if u create a new report u can create the reportbody, the section, the table and others. But don't show how to obtain this from an existing report.
    Probably i don't understand very well all the SDK structure and i think that is possbile to read a table(with horizantal axis) in a report without section only passing by the ReportBody.
    I know that u don't have so time to spent for things that are in the SDK, but if it's possible to have ten rows of sample about this question i'll be very happy.
    If it's not possibile, thank u very much for your interesting and disponbility and i'll try again and again and again to solve this.
    Matteo

Maybe you are looking for

  • Repetable row trouble with auto sum

    Hi, I'm really struggling with this table. Please take a look. What I want is to have fields Komada, m2, Iznos be summed up in a corresponding total field thats underneath the table. The trouble is I made a button that adds or substracts new table ro

  • Calender not work correctly

    I wrote this code to get the date for the first day of the week. So if todays date is 05/01/2002 it should out put 04/28/2002. The problem that I am having is that it will give me 05/29/2002. If I run this in a plain java file I get the correct date.

  • IPod deleted itself and freezes my computer

    yesterday my computer spontaneously deleted all of it's music and everytime i conenct it to my pc it freezes windows and im forced to restart. If i try restarting the computer into windows with the iPod still attached, windows refuses to load, and my

  • Abap-Xslt , XSLT

    Hi Experts,                        Can anybody send me step by step procedure of ABAP-XSLT Mappings.                   What is difference between Abap-Xslt and Xslt? Thanks

  • Add object in the list

    hi how are you guys ? i hope you all fine .. here ... iam trying to show the list items in the list .. but i couldn.t here first i created object and array object var za:int = 0 var itemsinfo:Object = new Object() var da:Array = new Array (100) then