.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 2nd, 2003, 10:39 AM
EiSa EiSa is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: Norway
Posts: 184 EiSa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 m 24 sec
Reputation Power: 7
Screen scraping between two points

I have permissions to scrape a Norwegian page, but I need to scrape it between two points in the source-code. I'm able to do this in regular ASP, but then it won't read Norwegian charachters properly. I have found a solution for that in ASP.NET using UTF7-encoding. My problem is that this code scrapes the entire page, I need the code only to read between two points. Is anyone able to help rewrite this code so it will be able to scrape between two points? I don't know ASP.NET myself so I'm not able to do it.

Code:
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>
<script language="VB" runat="server">
   Sub Page_Load(Src As Object, E As EventArgs)
           myPage.Text = readHtmlPage("http://www.yourdomain.no")
   End Sub

   Function readHtmlPage(url As String) As String
      Dim objResponse As WebResponse
      Dim objRequest As WebRequest
      Dim result As String
      objRequest = System.Net.HttpWebRequest.Create(url)
      objResponse = objRequest.GetResponse()
'use UTF7 Encoding to read special charachters and the Norwegian alphabet
      Dim sr As New StreamReader(objResponse.GetResponseStream(), System.Text.Encoding.UTF7)    
      result = sr.ReadToEnd().toString
   
      'clean up StreamReader
      sr.Close()
      return result
   End Function
</script>
<html>
<body>
<asp:literal id="myPage" runat="server"/>
</body>
</html>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > Screen scraping between two points


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT