Search for a value in an html page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dkalsow

    #1

    Search for a value in an html page

    Good Morning,

    Does anyone have an example (in vb .net) of how I can bring down an internal
    web html page into a string variable and then search for a specific string.
    The web page is internal and does not need any user to access it.

    Thanks.

    Dale
  • Cor Ligthert [MVP]

    #2
    Re: Search for a value in an html page

    Hi,

    This seems (beside mshtml what is difficult to use) to be the best for that.



    I hope this helps.

    Cor


    Comment

    • richwangler

      #3
      Re: Search for a value in an html page

      I believe you want to do this?

      Imports System.Net
      Imports System.IO

      Module Module1

      Sub Main()
      Dim myHttpWebReques t As HttpWebRequest =
      myHttpWebReques t.Create("http://www.google.com" )
      Dim myHttpWebRespon se As HttpWebResponse =
      myHttpWebReques t.GetResponse()
      Dim myStream As Stream = myHttpWebRespon se.GetResponseS tream
      Dim myStreamReader As New
      StreamReader(my HttpWebResponse .GetResponseStr eam)
      Debug.Write(myS treamReader.Rea dToEnd)
      End Sub

      End Module

      Comment

      • richwangler

        #4
        Re: Search for a value in an html page

        Broadened it out a bit...

        Imports System.Net
        Imports System.IO

        Module Module1

        Sub Main()
        Dim myHttpWebReques t As HttpWebRequest =
        myHttpWebReques t.Create("http://www.google.com" )
        Dim myHttpWebRespon se As HttpWebResponse =
        myHttpWebReques t.GetResponse()
        Dim myStreamReader As New
        StreamReader(my HttpWebResponse .GetResponseStr eam)
        Dim sHTML As String = myStreamReader. ReadToEnd
        Dim iIndex As Integer = sHTML.IndexOf(" Froogle")
        If iIndex > 0 Then
        Debug.Write("va lue found")
        Else
        Debug.Write("va lue not found")
        End If
        End Sub

        End Module

        Comment

        Working...