Results 1 to 3 of 3

Thread: Winsock as iNet.getpage ????

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    16
    Anyone have a snippit of code where they get winsock to behave as inet.getpage? I am just looking to download a web page and save it as a string.

    Under Win2000, iNet.getpage seems to be flakey and my attepmt at learnign winsock is not coming a long too fast.

    A specific example of using winsock to get the HTML source of a web page would be very helpful.


    thanks

    jfs
    ----

    http://www.learntogo.f.net

  2. #2
    Guest
    I'm not sure but I think it should be:
    Code:
    Private Sub GetHTML(ByVal sHost As String, ByVal sPage As String)
        'Stop any concurrent operations
        Winsock1.Close
        'Connect to the specified host. Eg. 200.56.144.9 or http://www.website.com
        Winsock1.Connect sHost, 80
        'Request the data of the page, Eg. Index.html, default.asp, files/about.htm, ...
        Winsock1.SendData "GET " & sPage
    End Sub
    Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
        Winsock1.GetData sHTML, vbString, bytesTotal
        'sHTML conatins the HTML of the requested page.
    End Sub

  3. #3
    Guest
    Correction:
    I think you should move this line to the Connect event of the Winsock control:
    Winsock1.SendData "GET " & sPage

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