Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Get the source of a webpage in VB

I want to get all the text from a webpage into VB so I can then do searches on the text. This is the page I want to read all the text from :
http://87.248.193.143/87.248.193.143/pbsvss.htm
[192 byte] By [Leceur] at [2007-11-11 7:00:27]
# 1 Re: Get the source of a webpage in VB
Hey man,

first of all, the context in which u want to write ur application is not clear to me.
If what u mentioned is ALL that u wanted to do, there are many methods.

U can use the WinHTTP API to connect directly to the website and get the data out of it.

Just refer this tutorial from MSDN to know how to do it.. its pretty straight forward.

MSDN WinHTTP (vb6) example.. (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winhttp/http/retrieving_data_using_visual_basic.asp)

However, If u want to get the html currently displayed inside an IE window, u have to be looking up about BHOs (browser helper objects).

which is here...

MSDN BHOs (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwebgen/html/bho.asp)

cheers... :WAVE:

Pradeep V
deeps_chennai at 2007-11-11 17:27:33 >
# 2 Re: Get the source of a webpage in VB
Thanks for your reply but the example imports a gif file and show it and changes the text. I want to download all the text from the URL above, and put that in a text box so I can do searches on it.....
Leceur at 2007-11-11 17:28:33 >
# 3 Re: Get the source of a webpage in VB
Thanks for your reply but the example imports a gif file and show it and changes the text. I want to download all the text from the URL above, and put that in a text box so I can do searches on it.....
---------------------
to get all text in the WebBrowsers current page do this:

Dim WebText As String
WebText$ = WebBrowser1.Document.InnerText

if you want the html code with it do this:

Dim WebText As String$
WebText$ = WebBrowser1.Document.documentElement.OuterHTML
XRsTX at 2007-11-11 17:29:42 >