Retrieving raw HTML from web site...

  • Thread starter Thread starter Terry Olsen
  • Start date Start date
* "Terry Olsen said:
I want to retrieve the raw HTML code from a web site into a file so I can
parse it. I tried lifting code out of Mike Gerlach's article
(http://msdn.microsoft.com/msdnmag/issues/02/10/SpiderinNET/default.aspx),

\\\
Imports System.IO
Imports System.Net
..
..
..
Public Function LoadTextFile(ByVal Url As String) As String
Dim wrq As WebRequest = WebRequest.Create(Url)
Dim wrp As HttpWebResponse = _
DirectCast(wrq.GetResponse(), HttpWebResponse)
Dim sr As StreamReader = _
New StreamReader(wrp.GetResponseStream)
Dim Text As String = sr.ReadToEnd()
sr.Close()
wrp.Close()
Return Text
End Function
///
 
Back
Top