-
I have a webbrowser on my form which is accessing a non-HTML file. The only contents of the file are two lines, with text on each line. No HTML tags. Nadda.
How do I read the first line of this page ONLY?
The .Document.DocumentElement.InnerHTML code was usless, as it gave me extra HTML tags which weren't in the document (as I said, it's a text file with two lines, text on each line).
Help? =)
-Git
-
Well,
Why dont you just try using the Winsock Control ?
Connect to the server manually using the winsock control ; connect to remoteport 80.
Then once the socket has been accepted, send the required bits of the HTTP protocol.
I cant remember it off hand, but if you just make yourself a little proxy app, and connect through it with your webrowser to the net you'll see the HTTP requests.
Anyway, the file should be downloaded <as is>.
- Jamie.
-
The problem is I don't know Winsock yet (although I'm going to learn it soon!).
I think I found a way around what I'm trying to do, so I won't even need the source.
Thanks anyway. =)
-Git
-
Well personally I'd stick with the winsock control.
One can do do a lot more with the winsock control than the inet controls.
- jamie
-
git, all you need is include the iNet control into your form and put this code under a CommandButton on click event will do.
Code:
Dim FirstLine
Dim WriteData As String
Dim HTML_Str As String
WriteData = Inet1.OpenURL("http://forums.vb-world.net", icString)
HTML_Str = Inet1.GetChunk(2048, icString)
Do While Len(HTML_Str) <> 0
DoEvents
WriteData = WriteData & HTML_Str
HTML_Str = Inet1.GetChunk(2048, icString)
Loop
FirstLine = Split(WriteData, vbCrLf, -1, vbTextCompare)
MsgBox "First line of text from http://forums.vb-world.net is " & FirstLine(0)
Cheers!