Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Access web page text from C#

Access web page text from C#

Scheduled Pinned Locked Moved C#
csharphtmlcomhelpquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mark T
    wrote on last edited by
    #1

    20 Feb 2007 I want to gather data from this page: http://moneycentral.msn.com/investor/StockRating/srstopstocksresults.aspx?Score=10 and process it in C#. The problem is the page content is loaded via scripts (I think) and the page's .html source does not contain the data. So my initial idea of getting and processing the page's .html source won't work. Manually typing Control-A Control-C and pasting into a text document would work, but I'd prefer an automated solution. A. Is there an easy way to actually handle the scripts from within C# (or .NET in general)? OR B. I've never done control of another program through C#, although I understand that .NET allows this. Can my browser be controlled to send me the text or save it to a file? OR C. Perhaps a FireFox plug-in should be written? (I've never written a plug-in before, either.) Suggestions would be appreciated. Thanks, Mark

    P M 2 Replies Last reply
    0
    • M Mark T

      20 Feb 2007 I want to gather data from this page: http://moneycentral.msn.com/investor/StockRating/srstopstocksresults.aspx?Score=10 and process it in C#. The problem is the page content is loaded via scripts (I think) and the page's .html source does not contain the data. So my initial idea of getting and processing the page's .html source won't work. Manually typing Control-A Control-C and pasting into a text document would work, but I'd prefer an automated solution. A. Is there an easy way to actually handle the scripts from within C# (or .NET in general)? OR B. I've never done control of another program through C#, although I understand that .NET allows this. Can my browser be controlled to send me the text or save it to a file? OR C. Perhaps a FireFox plug-in should be written? (I've never written a plug-in before, either.) Suggestions would be appreciated. Thanks, Mark

      P Offline
      P Offline
      patt
      wrote on last edited by
      #2

      Try System.Net.Webrequest .. to create a request for the page, and if you're not sure of a correct response, use WebResponse.GetResponseStream() to process the response Patt

      M 1 Reply Last reply
      0
      • P patt

        Try System.Net.Webrequest .. to create a request for the page, and if you're not sure of a correct response, use WebResponse.GetResponseStream() to process the response Patt

        M Offline
        M Offline
        Mark T
        wrote on last edited by
        #3

        Thanks for the try, but this just retrieves the general page setup and the scripts themselves... none of the data that is displayed on the page is in what is obtained. (I do really appreciate the pointer to these functions, however. I need them for another project I have in mind!) Still looking for a solution. Mark

        P 1 Reply Last reply
        0
        • M Mark T

          Thanks for the try, but this just retrieves the general page setup and the scripts themselves... none of the data that is displayed on the page is in what is obtained. (I do really appreciate the pointer to these functions, however. I need them for another project I have in mind!) Still looking for a solution. Mark

          P Offline
          P Offline
          patt
          wrote on last edited by
          #4

          Maybe you can be a little more specific about the "data" you are looking for. I'm assuming you need the items displayed in the 6 column result table on the page ? Patt

          _ 1 Reply Last reply
          0
          • P patt

            Maybe you can be a little more specific about the "data" you are looking for. I'm assuming you need the items displayed in the 6 column result table on the page ? Patt

            _ Offline
            _ Offline
            __DanC__
            wrote on last edited by
            #5

            Sounds like it uses AJAX to retrieve the data? Maybe you could see what URL is being called by the script from the page source?

            1 Reply Last reply
            0
            • M Mark T

              20 Feb 2007 I want to gather data from this page: http://moneycentral.msn.com/investor/StockRating/srstopstocksresults.aspx?Score=10 and process it in C#. The problem is the page content is loaded via scripts (I think) and the page's .html source does not contain the data. So my initial idea of getting and processing the page's .html source won't work. Manually typing Control-A Control-C and pasting into a text document would work, but I'd prefer an automated solution. A. Is there an easy way to actually handle the scripts from within C# (or .NET in general)? OR B. I've never done control of another program through C#, although I understand that .NET allows this. Can my browser be controlled to send me the text or save it to a file? OR C. Perhaps a FireFox plug-in should be written? (I've never written a plug-in before, either.) Suggestions would be appreciated. Thanks, Mark

              M Offline
              M Offline
              Mark T
              wrote on last edited by
              #6

              The information that I want is the large table of Stock related information. I tried looking at links in the .html source, and the one that I suspect provides the content gave an "invalid" reply from a database. Perusing the scripts (which I do not know how to read) it appears the script and the database may exchange some password-like information before allowing the query. Still looking for a way to capture the text that the Web browser has already obtained, without doing a manual copy and paste to a text file. Mark

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups