Results 1 to 5 of 5

Thread: Source!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225

    Talking

    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

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359

    Cool

    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.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225
    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

  4. #4
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    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
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  5. #5
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width