|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
copy HTML informationI 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" <DeezN***@yahoo.com> wrote in message Hope this one helps: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. > > 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 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 > > 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 > > 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 > >
VB Express SQL Express Remote Connection
Trouble with "Process's" please help! .NET equivilant of isnumeric Datagridview Search? Merging Datasets Incorrect behavior of IIf in VB.NET (.NET Framework 1.1 SP1) Text missing from RadioButtons in Groupbox can I use Imports with a VB2005 class namespace? Remove x number of charaters from string. Vb.net Trouble Instanciating Structures |
|||||||||||||||||||||||