Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Screen Scraping Code


Message #1 by "Phil McAllister" <mcallpl@h...> on Mon, 10 Jun 2002 12:50:47 -0700
The difference IMO is that in this example, you have access to the actual 
contents of the page. In a frame scenario, you can just display the other 
page, but not use it.

The code below dumps the contents of the other page in the Text property of 
some object. However, when you assign it to a string, you have full access 
to it.
For example, you could remove image tags, load an XML object with its 
contents, alter the content and so on. This won't be allowed in a frame 
scenario as you can't access contents of a frame that does not originate 
from the same server.

Imar


At 12:50 PM 6/10/2002 -0700, you wrote:
>I copied the following Screen Scraping code from ASPPRO.NET Magazine.  The 
>reason I took interest is because of all of the hooplah of the greatness 
>of screen-scraping.  Now, the code below works fine.  However, I have no 
>idea what the value is.  I thought it would scrape any screen, and allow 
>me to re-use a portion of the code in my webpages so that when the 
>originating party updated their website, mine would also be 
>updated.  However, I am confused as to how is this different than the 
>frame-like functionality of including one page within another.  Please 
>help me understand the value (and usefulness).
>
>****************************
>
><%@ Page Language="VB" %>
><%@ Import Namespace="System.Net" %>
><%@ Import Namespace="System.IO" %>
><script language="VB" runat="server">
>
>Sub GetScreen_Click(sender as Object, e as EventArgs)
>dim encASCIIEncoding as new asciiencoding
>dim wcWebClient as New WebClient
>
>Try
>
>         Returndata.text = 
> encasciiencoding.getstring(wcwebclient.DownloadData(URLToScrape.Text))
>catch
>         Returndata.text = "An error has occurred while executing your 
> request.  Did you forget the http://?"
>end try
>end sub
></script>



  Return to Index