Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scrape HTML 2

Status
Not open for further replies.

eichmat

MIS
Oct 24, 2002
20
US
Ok--I've got a project where I've got to load the HTML response form a URL into a string, then strip out key parts of the page.

In VB 6.0 I used an object called ASPTear which took a URL and returned the HTML as a string. I figuired that .NET might have such an item built in, but looking through the .NET online help, didn't see anything (lost of stuff for producing HTML, but didn't see anything that took a URL and returned the page).

Any help appreciated,


-Tim
 
Try the System.Net Namespace
This should get you started:
Private Sub GetWebPage
Dim objResponse As Net.WebResponse
Dim objRequest As Net.WebRequest
Dim objStreamReader As System.IO.StreamReader
Dim strResult As String

objRequest = Net.WebRequest.Create(" objResponse = objRequest.GetResponse()
objStreamReader = New System.IO.StreamReader(objResponse.GetResponseStream)
strResult = objStreamReader.ReadToEnd
End Sub
 
Thanks! That was perfect! It even handled the re-direct I had to detail with by making striping out the redirect info then making a second web-call...

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top