This is a small function that allows a user to retrieve the text from a website minus the HTML.
VB Code:
Public Function RemoveHtml(ByVal sURL As String) As String Dim oHttpWebRequest As System.Net.HttpWebRequest Dim oStream As System.IO.Stream Dim sTemp As String oHttpWebRequest = (System.Net.HttpWebRequest.Create(sURL)) Dim oHttpWebResponse As System.Net.WebResponse = oHttpWebRequest.GetResponse() oStream = oHttpWebResponse.GetResponseStream sTemp = System.Text.RegularExpressions.Regex.Replace(New System.IO.StreamReader(oStream).ReadToEnd(), "<[^>]*>", "") oStream.Close() oHttpWebResponse.Close() Return sTemp End Function
To use it simply pass in the url of the website that you want to retrieve the text from
VB Code:
textbox1.text = RemoveHtml("http://www.vbforums.com")
Cheers
MarkusJ




Reply With Quote