Retrieving a webpage source HTM and checking for a string thereinL?

  • Thread starter Thread starter me
  • Start date Start date
M

me

Hi all,

Can anyone give me any pointers on how to do the following in VB.NET?

Basically, I want a procedure that will take a web URL and a string as
parameters, e.g. www.microsoft.com and 'Bill Gates'

I want the procedure to pull that page from the web, check for the existence
of 'Bill Gates' and return either true or false depending on whether or not
the string can be found.

I suppose all I need to know is - what is an effecient way to pull the HTML
source from any URL?

Help appreciated :)
 
How about this?
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Private Function FindBill as Boolean

Dim hreq As HttpWebRequest = _
HttpWebRequest.Create("http://www.microsoft.com")

Dim hres As HttpWebResponse = hreq.GetResponse
Dim sr As New StreamReader(hres.GetResponseStream)
Dim tmpRes As String = UCase(sr.ReadToEnd)
sr.Close()
hres.Close()

If tmpRes.IndexOf("Bill Gates") >= 0 Then
Return True
Else
Return False
End If

End Function
 
me said:
Hi all,

Can anyone give me any pointers on how to do the following in VB.NET?

Basically, I want a procedure that will take a web URL and a string as
parameters, e.g. www.microsoft.com and 'Bill Gates'

I want the procedure to pull that page from the web, check for the
existence
of 'Bill Gates' and return either true or false depending on whether or
not
the string can be found.

I suppose all I need to know is - what is an effecient way to pull the
HTML source from any URL?

Help appreciated :)


Cheers to all of you - worked a treat :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top