Results 1 to 3 of 3

Thread: Getting Source Code

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 1999
    Posts
    12

    Post

    What is the source code to connect to a website, and get the source code and put it in a txt box?

  2. #2
    Lively Member
    Join Date
    Nov 1999
    Location
    Melbourne, Victoria, Australia
    Posts
    126

    Post

    Here's how to open a file via Winsock.
    An easier way is using Internet Control but here is how to do it via Winsock.

    This code will add some HTTP header info that you will need to remove, Internet Control does this automatically...

    This code is not perfect, its from the top of my head, if you want the exact code
    Email me for it.. Add a winsock control to a new form and a text box and a command button

    '---------------------------------------------------
    ' Download a file directly via Winsock via HTTP port
    '---------------------------------------------------
    '

    Dim DownloadData as String

    Private Sub DownloadCMD_Click()
    'connect to the web server directly
    winsock1.connect "www.website.com", 80
    End Sub

    Private Sub Winsock1_Connect()
    'weve connected, lets send the HTTP request
    'you MUST have the two vbcrlf after the command
    winsock1.senddata "GET /index.htm HTTP/1.0" & vbcrlf & vbcrlf
    End Sub

    Private Sub Winsock1_DataArrival(totalBytes as long)
    'weve recieved some data, append it
    winsock1.getdata TempDownloadString, vbString
    DownloadData = DownloadData & TempDownloadString
    End Sub

    Private Sub Winsock1_Close()
    'download has completed, save the data to a file

    Text1.text = DownloadData
    End Sub


    [This message has been edited by privoli (edited 11-08-1999).]

  3. #3
    New Member
    Join Date
    Jan 1999
    Location
    WI
    Posts
    5

    Post

    1) So when you are done downloading a page, it automatically closes the connection?

    2) How come it doesn't work for me? I try to connect to www.pinionsolutions.com and everytime I request a page to download, it returns a 302 error saying that the page has moved! But how has it moved if it's in the same place it always was (it says it has moved to index.html, the same url I requested)? Just try it and see what I mean.

    Thanks!

    -Matthew B.

    [This message has been edited by MatBielich (edited 11-13-1999).]

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