Home All Groups Group Topic Archive Search About

copy HTML information

Author
22 Aug 2006 11:36 PM
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.

Author
23 Aug 2006 4:51 PM
Timo
"Daniel N" <DeezN***@yahoo.com> wrote in message
news:myMGg.95$k%3.58@newsfe12.lga...
>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
Author
23 Aug 2006 5:48 PM
Daniel N
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

Show quoteHide quote
"Timo" <timo.r.lehti***@luukku.com>

> 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
>
>
Author
24 Aug 2006 6:49 AM
Timo
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

  "Daniel N" <DeezN***@yahoo.com> wrote in message news:4y0Hg.1$Pz4.0@newsfe09.lga...
  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

Show quoteHide quote
  "Timo" <timo.r.lehti***@luukku.com>

  > 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
  >
  >
Author
24 Aug 2006 1:44 PM
Nathaniel
How do I post that information into like a text box or a string?
  "Timo" <timo.r.lehti***@luukku.com> wrote in message news:g_bHg.10315$_P4.7645@reader1.news.jippii.net...
  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

    "Daniel N" <DeezN***@yahoo.com> wrote in message news:4y0Hg.1$Pz4.0@newsfe09.lga...
    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

Show quoteHide quote
    "Timo" <timo.r.lehti***@luukku.com>

    > 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
    >
    >