How do I obtain data from a web site???

I am trying to use information from a sports stats page to automate scoring on a fantasy football site I am developing. After a game the weeks games have completed, I want to be able to extract the data, passing yards, passing TD's, etc. I can pull in a web site, and get to the point where the QB stats start. My question is there a way to strip all the html tags and just be left with the players name and numbers(stats)? I skip down 366 lines to get to the example below. Was thinking maybe, to tokenize using > as the delimiiter, then tokenizing again to strip away the rest of the tag using < as the delimiter. Any suggestions are much appreciated, thanks.
CODE
import java.net.*;
import java.io.*;
public class WebRipper
public static void main(String[] argv)
int count = 0;
try {
// Create a URL for the desired page
URL url = new URL("http://www.fftoday.com/stats/playerstats.php?Season=2006&GameWeek=1&PosID=10&Le agueID=1");
// Read all the text returned by the server
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String str;
while ((str = in.readLine()) != null)
if(count > 366)
System.out.println(str);
}// end if
count ++;
}// end while
in.close();
}// end try
catch (MalformedURLException e) {}
catch (IOException e) {}
}// end main
}// end WebRipper
OUTPUT(this is just a example of the first few lines of output)
<TD CLASS="sort1" ALIGN="LEFT" BGCOLOR="#ffffff"> 1. Donovan McNabb</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">PHI</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">1</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">1</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">24</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">35</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">314</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">3</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">1</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">4</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">7</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">0</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#e0e0e0">28.4</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">28.4</TD>
</TR>

Here is the first string I would want to obtain, can you explain how I would get the player name, then all of his stats. Remember there is ~366 lines of text before you get to this point. Also what or where should I dump the info to?
Example from the info below I want Donovan McNabb, then all of his stats, excluding all the tags.
<TD CLASS="sort1" ALIGN="LEFT" BGCOLOR="#ffffff"> 1. Donovan McNabb</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">PHI</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">1</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">1</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">24</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">35</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">314</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">3</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">1</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">4</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">7</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">0</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#e0e0e0">28.4</TD>
<TD CLASS="sort1" ALIGN="center" BGCOLOR="#ffffff">28.4</TD>
</TR>
Pattern p = Pattern.compile("(?<=\\>)[^<]+");
Matcher matcher = p.matcher(yourwebinfo);
while(matcher.find())
yourinfow/ohtmlcode = matcher.group();
Thanks.

Similar Messages

  • How to show data from one web site to other web site having diffrent domain.

    Dear all,
             i want to show the selected data from one web site to other web site.
    the location of the two web site is geographically seprated (and diffrent domain)
    Please tel me in how many ways it can be accomplished.
    If it can be done using jquery then please tel me the function or procedure to do it.
    Note: ( i have seen the above behavior in many web sites .
    like, i was purchasing some thing but finally declined,
    after that i visited some other web sites to gets some other data on other area
    , and i show my selected items of the first web site  on second website as advertisement.)
    i would like to know how these things are accomplished and how it can be done in asp.net.
    yours sincerely

    Hello,
    Thank you for your post.
    I am afraid that the issue is out of support range of VS General Question forum which mainly discusses
    the usage of Visual Studio IDE such as WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
    and Visual Studio Editor.
    Because your issue is about ASP.NET website programming, I suggest that you can consult your issue on ASP.NET forum:
    http://forums.asp.net/
     for better solution and support.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How do I add dates from a web page into iCal?

    Hello. I would love to find a way to input dates from a web page, into iCal as an event. Right now, if there is a conference or whatever that is on such and such a date, I have to keep the web page open that has the dates and time, and then open iCal, and create a new event on that date, etc. Is there a way to highlight said dates on a web page, run some automation, and voila, it is a new event in iCal?

    Don't double tap. Just try pressing on the text. That should highlight it.

  • How to add "Prepare Data" from a web service to the form

    Hello,
    Can any one please advise on how to add the "Prepare Data" process from the existing web service and have the form to pre-populate the data from this "Prepare Data" process instead of using schema xsd. I heard that this is an alternative or may be a better way to pre-populate data in ES2/ES3 to avoiding creating a data source in Form Designer. I try to find a sample on Adobe site but could not find one, most of them are using schema.
    Any guidance or URL to the sample would be helpful.
    Thanks,
    HD

    Thanks

  • How can I input data from a Frontend site into a Backend SWF, pull data, then send back to Front?

    So here's what I'm trying to figure out...
    I have a site with an SWF that I can put some metrics into, such as ZIP Code, Weight, etc..    then, it takes that info and gives me shipping rates.
    I need to build a front-end site that I can have a forms page that will push data to the backend SWF, and then return the data back from the SWF to the front end.
    Any ideas how to do that?
    Front-end -> SWF (Zip Code, Weight, Size) -> *Calculates* -> Front-End
    That should be the flow..     So I need to send data to the backend, GET the data that it calculated, and return the results to my front-end.
    Thanks Much..  any questions, please ask..

    Depending on what the data looks like coming from the Flash movie, you can use the get or send method to output data from the Flash movie using URLRequest. You can look at the online help example for the URLVariables class. You will still need to use or create a server side script to read in the data, make the changes and send the modified data back. That will be a perl or PHP script and is outside the scope of this forum.

  • How to view HR photo from a web-site NOT using ArchiveLink NOR ContentRep.

    Hello,
    We have a web site where ALL our employees' photos are maintained.
    It is accessible via HTTP with one of the parameters is the ID number of the employee.
    Is it possible to customize the PA in such a way that it will display the photo in the SAPgui by accessing the photo using a URL ?
    For example the following URL:
    http://<server_name>:<server_port>/hr_photo/EMPLOYEE_ID.jpg
    Please, help.
    Thanks and kind regards,
    Gil Halevy

    I know what you are asking for but sadly, it is NOT possible without customization. I have had 2 past clients with this issue....typically they had the employee photos on some common intranet server in some folder and simply referenced them by "(username).jpg" through some kind of custom employee directory app/web page. Since ESS services, many MSS services, HRAS services, etc. via the portal and then also SAPGui transactions rely on the ArchiveLink config for photos as standard, we had to load all the photos into ArchiveLink and do it the "right" way. It actually is VERY easy to do. The added benefit that the clients like too is that you can have SEVERAL photos (such as photos over time) for a single employee (since there is no longer the dependence on the naming of the image file such as (employee#).gif or (userid).jpg. Sooooo....sorry I don't have the answer you wanted, but hopefully my answer helped.

  • When I copy and paste the data from a web site in to excel, it comes in one big splurge - ie it is not 'delimited' - and I can't see how to delimit the data into cells. In Explorer, the data is delimited. Any clues ? John

    see above

    A couple of options:
    # When pasting the data into Excel use Paste Special, and choose either Text or Unicode Text.
    # Use the Dafizilla Table2Clipboard extension to copy the data - https://addons.mozilla.org/firefox/addon/dafizilla-table2clipboard

  • How can i paste text from a web site to an open office document as rtf?

    i'm running firefox under windows 7. i'm unable to copy text from web pages to the clipboard as rtf formatted data. tried pasting into ms wordpad and open office 3.3 writer. ie allows pasting as rtf text, but i'd prefer using firefox. why is rtf not an available format?

    Curnow 1 wrote the following:  "you should do a tap wait a sec and 1 more tap in the same place and hold the Second tap ;https://www.dropbox.com/s/23whtlt2gizxu27/MOV_1048.mp4?dl=0" Curnow1, this actually worked! Holy Cow, who'da thought?!!Thank you. I gave you a kudo and I marked this as a solution. Thanks again!PS - I'm amazed at how long it takes me to accomplish seemingly simple things with a smart phone. This is my first smart phone ever. I am a former computer programmer and am very PC literate. Still, sometimes I pull my hair out. Thanks again! 

  • Getting data from a web site

    I have a device that has a built in web server that I need to write a LV program for
    I need to read the date the web server is producing and compare it to actcual measured data.
    Now the measureing and comparing is easy but I don't know how to make LV read a webpage.
    Any thoughts or examples?
    Solved!
    Go to Solution.

    I got it to work, but It seem like the first time I launch it I sometimes I the first time I run it I get this error.
    Error 97 occurred at UnknownSystem Error
    Possible reason(s)
    Labview: Null Refnum was passed as input.
    Also it does not always ouput the text the first time and you have to run it twice. 
    Worse yet it seems to cache the text so sometimes when you load a new page the text is still the text left over from the previous page yet you can see the new page has loaded in the SHDocVw.IWebBrowser2 indicator.
    Attachments:
    No Text Output-1.jpg ‏136 KB
    Good Text Ouput-2.jpg ‏220 KB
    Text Output has not changed.jpg ‏173 KB

  • How to download an applet from the web sites?

    There are few applets I saw online that I would like to download for my project. But I don't know is it to be downloaded. Is it by copying the HTML code & embeded into the HTML coding? Or can I just view it with normal applet viewer? Thanks! God Bless!

    Try to trick the page (take care at the copyright)
    Consider the address is www.address.com/dir1/pag1.html
    Check the source of the page and check the link to the applet.
    Consider the link:
    <applet code=dir2/appletName.class ....
    Then enter into the browser: www.address.com/dir1/dir2/appletName.class and you will download the applet.
    The html file you can download using right-click - view source
    Good luck

  • How to search for data on the web and return to jsp

    I need to collect data from a web site and return that data to my jsp file. The page should consist of a web page in which the user search for available flights then I conect to easyjet automatically fill in the form and return the result from easyjet.com to my jsp file..Do anyone know how can I do this?? I need to use java for this and not cgi..I found also some JavaScripts that can perform the same thing..Thanks...

    Hi,
    are you able to change dynamically the  operation.url = "assets/data/shopping.xml";?
    i need to do that based on the users input.
    Thanks in advance,

  • How to retrieve data from a web service

    Hi
    i am at very beginner level about web services.
    I am searching for a simple example of retrieving data from a web services, but cant find.
    How can i get xml data from a web service. i dont need to develop the web service it is already ready, i just need how could i fetch data from it.
    Can somebody point out or give an example?
    Thanks in advance

    Hi,
    just create a skeleton for the Web Service. In JDeveloper, create a new project and then use the "NEW" context menu option.
    Navigate to "Business Tier" --> Web Services and select "Web Service Proxy"
    In teh following, provide the WSDL reference to create the Java proxy. This gives you accss to the WS without having to parse the XML yourself
    Frank

  • Regarding how to pass the data from web dynpro to workflow

    hi gurus,
    how to pass the data from web dynpro to workflow.
    Regards
    vijay

    Check this [thread|SAP_WAPI_START_WORKFLOW;

  • How to pass the data from web dynpro to workflow.

    hi gurus,
    how to pass the data from web dynpro to workflow.
    Regards
    vijay

    Hi
    you can use function module
    data   ls_input_container  TYPE swr_cont.
    data   lt_input_container  TYPE TABLE OF  swr_cont.
    CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
        EXPORTING
          task            = ptask
        IMPORTING
          return_code     = lv_return_code
          new_status      = lv_new_status
        TABLES
          input_container = pinput_container
          message_lines   = lt_message_lines
          message_struct  = lt_message_struct.
    where you pass the data in imnternal table "pinput_container" as
      ls_input_container-element = 'KUNNR'.
      ls_input_container-value = ls_skna1-kunnr ."wd_this->lv_kunnr.
      APPEND ls_input_container TO lt_input_container .
      ls_input_container-element = 'CLUSER'.
      ls_input_container-value = lv_cluser.
      APPEND ls_input_container TO lt_input_container .
      ls_input_container-element = 'BUKRS'.
      ls_input_container-value = lv_bukrs. " youe value as per requirement.
      APPEND ls_input_container TO lt_input_container .
      ls_input_container-element = 'VKORG'.
      ls_input_container-value = ls_sknvv-vkorg. " youe value as per requirement
      APPEND ls_input_container TO lt_input_container .
      ls_input_container-element = 'VTWEG'.
      ls_input_container-value = ls_sknvv-vtweg. "youe value as per requirement.
      APPEND ls_input_container TO lt_input_container .
      ls_input_container-element = 'SPART'.
      ls_input_container-value = ls_sknvv-spart. "youe value as per requirement.
      APPEND ls_input_container TO lt_input_container .
    *Also Forgot to mention where ptask is your workflow ID *
    Regards,
    Arvind
    Edited by: Arvind Patel on May 14, 2010 7:38 AM

  • How to send data from a web dypro application using workflow

    Hi All,
    I am working on a web dynpro application where the user will enter the header and item details for a FI document to be posted. Once the user enters the data the workflow should initiate and should also send the data across to the approver to approve. To initiate the workflow I am using the function module 'SAP_WAPI_START_WORKFLOW' and it's working fine and generating a uniquw workflow item id. Now my main concern is how to send the data across from web dynpro application through the workflow. I have my data in three internal tables: 1. header table. 2. G/L table and 3. Currency table, I am capturing all this data from the web dypro screen entered by the user. Right now I have the following code in my web dypro application.
    METHOD execute_bapi_acc_document_post .
      DATA: return TYPE TABLE OF bapiret2.
      DATA: wa_return LIKE LINE OF return.
      DATA lo_bapi_acc_document_po TYPE REF TO if_wd_context_node.
      DATA lo_changing TYPE REF TO if_wd_context_node.
      DATA lo_accountgl TYPE REF TO if_wd_context_node.
      DATA lo_currencyamount TYPE REF TO if_wd_context_node.
      DATA lo_importing TYPE REF TO if_wd_context_node.
      DATA lo_documentheader TYPE REF TO if_wd_context_node.
      DATA lo_element TYPE REF TO if_wd_context_element.
      DATA lt_elements TYPE wdr_context_element_set.
      DATA ls_c_documentheader TYPE if_componentcontroller=>element_documentheader.
      DATA lt_c_accountgl TYPE if_componentcontroller=>elements_accountgl.
      DATA ls_c_accountgl LIKE LINE OF lt_c_accountgl.
      DATA lt_c_accountgl_cp TYPE if_componentcontroller=>elements_accountgl.
      DATA lt_c_currencyamount TYPE if_componentcontroller=>elements_currencyamount.
      DATA ls_c_currencyamount LIKE LINE OF lt_c_currencyamount.
      DATA lt_c_currencyamount_cp TYPE if_componentcontroller=>elements_currencyamount.
      DATA wa_c_currencyamount type bapiaccr09.
    CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
      EXPORTING
        TASK                      = 'TSXXXXXXXXXX'            
       USER                      = sy-uname
    IMPORTING
       RETURN_CODE               = L_RETURN_CODE
       WORKITEM_ID               = LV_WIID
    TABLES
    *   INPUT_CONTAINER           = lt_input_container
       MESSAGE_LINES             = lt_message_lines
       AGENTS                    = ls_agents
      lo_bapi_acc_document_po = wd_context->get_child_node( wd_this->wdctx_bapi_acc_document_po ).
      lo_changing = lo_bapi_acc_document_po->get_child_node( wd_this->wdctx_changing ).
      lo_accountgl = lo_changing->get_child_node( wd_this->wdctx_accountgl ).
      lo_currencyamount = lo_changing->get_child_node( wd_this->wdctx_currencyamount ).
      lo_importing = lo_bapi_acc_document_po->get_child_node( wd_this->wdctx_importing ).
      lo_documentheader = lo_importing->get_child_node( wd_this->wdctx_documentheader ).
      lo_element = lo_documentheader->get_element( ).
      lo_element->get_static_attributes(
        IMPORTING static_attributes = ls_c_documentheader ).
      lt_elements = lo_accountgl->get_elements( ).
      LOOP AT lt_elements[] INTO lo_element.
        lo_element->get_static_attributes( IMPORTING static_attributes = ls_c_accountgl ).
        INSERT ls_c_accountgl INTO TABLE lt_c_accountgl[].
      ENDLOOP.
      lt_c_accountgl_cp = lt_c_accountgl[].
      lt_elements = lo_currencyamount->get_elements( ).
      LOOP AT lt_elements[] INTO lo_element.
        lo_element->get_static_attributes( IMPORTING static_attributes = ls_c_currencyamount ).
        INSERT ls_c_currencyamount INTO TABLE lt_c_currencyamount[].
      ENDLOOP.
      lt_c_currencyamount_cp = lt_c_currencyamount[].
      READ TABLE lt_c_currencyamount INTO ls_c_currencyamount INDEX 2.
      ls_c_currencyamount-amt_doccur = ls_c_currencyamount-amt_doccur * '-1.0000'.
      MODIFY lt_c_currencyamount FROM ls_c_currencyamount INDEX 2.
      CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
        EXPORTING
          documentheader = ls_c_documentheader
        TABLES
          accountgl      = lt_c_accountgl
          currencyamount = lt_c_currencyamount
          return         = return.
    ENDMETHOD.
    Please suggest.
    Thanks,
    Rajat
    I am not sure if this falls in webdynpro or workflow threads.. so I am posting it here also
    Edited by: rajatg on Jun 23, 2010 9:28 PM

    Dear Colleague,
    You have different method to send parameters to Workflow.
    1. Method
    Container Set Element
    DEFINE SWC_SET_ELEMENT.
      CALL FUNCTION 'SWC_ELEMENT_SET'
        EXPORTING
          ELEMENT   = &2
          FIELD     = &3
        TABLES
          CONTAINER = &1
        EXCEPTIONS
          OTHERS    = 1.
    END-OF-DEFINITION.
    Set the data into Workflow container
        SWC_SET_ELEMENT IT_CONTAINER 'parameter1' lv_parameter1.
    Start the Workflow
        CALL FUNCTION 'EWW_WORKFLOW_START'
          EXPORTING
            X_TASK          = 'WS90000001'   " your wf
          IMPORTING
            Y_WORKFLOW_ID   = WF_ID " your workitem id
          TABLES
            X_CONTAINER     = IT_CONTAINER
          EXCEPTIONS
            INVALID_TASK    = 1
            NO_ACTIVE_PLVAR = 2
            START_FAILED    = 3
            GENERAL_ERROR   = 4
            OTHERS          = 5.
    2. Method,
    You can also add your parameters direly to a container,
      DATA: lt_simple_container TYPE TABLE OF swr_cont,
            ls_simple_container TYPE swr_cont.
      ls_simple_container-element = 'parameter1'.
      ls_simple_container-value = lv_parameter1.
      APPEND ls_simple_container TO lt_simple_container.
      CALL FUNCTION 'SAP_WAPI_WRITE_CONTAINER'
        EXPORTING
          workitem_id      = WF_ID " your workitem id
          do_commit        = 'X'
        TABLES
          simple_container = lt_simple_container.
    Bulent.

Maybe you are looking for

  • Why doesn't my ical and address book no longer sync between the iphone4S and my MacBook?

    Can anyone explain why the new iphone doesn't sync back to my MacBook. My ical won't sync, nor will my address book when I make changes to either device? I just bought the phone today and no one at the Mac Store could provide any assistance. I was to

  • DUMP CRITICAL ERROR - SAP R/3 Enterprise

    Hello Guys, I am with the following error in my environment DEV, with the QAS environments and PRD does not happen the same mistake. The error occurs when I try to access the table BSEG through transacão SE16. The Dump what happens is: DBIF_RSQL_INVA

  • How to read data from clusters ( Time Management )

    Hi All,    How can we read data from cluster tables related to Time Management in different ways?    Can somebody help me please.. Thanks, Sankar.

  • PO Messages

    Hello   We are using messaging functanality. I created a PO with 1 line item and then deleted it. I could see that message (Fax) has been sent to vendor successfully. But I want to see what got sent over to vendor. How can I see the image? Thanks Ank

  • Quick find a clip embedded in sequence

    I have 85 sequences on the timeline. There are some clips that are scattered around in those sequences that I need to replace. Those bad clips got messed up and has no timecode for me to just redigitize. I need a quick way to find a clip within the 8