Estoy intentando leer páginas web, por ejemplo me gustaría detectar el string "My server" en la respuesta.
He encontrado esto:
Dim Str As System.IO.Stream
Dim srRead As System.IO.StreamReader
Try
' make a Web request
Dim req As System.Net.WebRequest = System.Net.WebRequest.Create("http://localhost/quietoputo")
Dim resp As System.Net.WebResponse = req.GetResponse
StR = resp.GetResponseStream
srRead = New System.IO.StreamReader(Str)
' read all the text
RichTextBox1.Text = srRead.ReadToEnd
Catch ex As Exception
RichTextBox1.Text = "Unable to download content"
Finally
' Close Stream and StreamReader when done
srRead.Close()
Str.Close()
End Try
Si entramos a la web simplemente vemos un título "My server:" seguido de otro título con la IP. Mi intención es detectar si la web que he visitado tiene el string "My server:" y guardar la IP en un textbox o variable o lo que sea.
¿Cómo podría hacerlo?
Dim texto as String = srRead.ReadToEnd
y haz una busqueda en texto:IF texto.Contains("My Server")...