copy HTML information

  • Thread starter Thread starter Daniel N
  • Start date Start date
D

Daniel N

I am trying to automatically relay information displayed on an HTML page to
my program I am writing in VB.net. I know the window handle, the window
title, and process, but do not know what to do next.
 
Daniel N said:
I am trying to automatically relay information displayed on an HTML page to
my program I am writing in VB.net. I know the window handle, the window
title, and process, but do not know what to do next.

Hope this one helps:

Dim HttpWebReq As System.Net.HttpWebRequest
Dim WebResp As System.Net.HttpWebResponse
Dim WebStream As System.IO.Stream
Dim WebReader As System.IO.StreamReader
Dim PageHTML As String

HttpWebReq = CType(WebRequest.Create("http://www.contoso.com/"),
HttpWebRequest)
WebResp = CType(HttpWebReq.GetResponse(), System.Net.HttpWebResponse)
WebStream = WebResp.GetResponseStream
WebReader = New System.IO.StreamReader(WebStream, Encoding.Default)
PageHTML = WebReader.ReadToEnd
WebResp.Close() ' Close finally to free resources
 
How should I declare WebRequest, HttpWebRequest and Encoding? They come up undeclaured when I copy and paste.

I just wanted to read one section of informaiton from a website, but I dont not know the site address, an executable launches a web app that gives me certian information, and I just wanted to copy that into a string or integer.

Thanks for the help
 
Ok. Import namespaces:

Imports System.IO
Imports System.Net
Imports System.Text

that should help. Variable PageHTML will contain the content
of the www-page. Extract the section from it. Replace
"http://www.contoso.com/" with the url you want to access.
However, if you do not know the url then this won't be the
solution you're looking for.

- Timo

How should I declare WebRequest, HttpWebRequest and Encoding? They come up undeclaured when I copy and paste.

I just wanted to read one section of informaiton from a website, but I dont not know the site address, an executable launches a web app that gives me certian information, and I just wanted to copy that into a string or integer.

Thanks for the help
 
How do I post that information into like a text box or a string?
Ok. Import namespaces:

Imports System.IO
Imports System.Net
Imports System.Text

that should help. Variable PageHTML will contain the content
of the www-page. Extract the section from it. Replace
"http://www.contoso.com/" with the url you want to access.
However, if you do not know the url then this won't be the
solution you're looking for.

- Timo

How should I declare WebRequest, HttpWebRequest and Encoding? They come up undeclaured when I copy and paste.

I just wanted to read one section of informaiton from a website, but I dont not know the site address, an executable launches a web app that gives me certian information, and I just wanted to copy that into a string or integer.

Thanks for the help
 
Back
Top