Results 1 to 9 of 9

Thread: Get Internet Site Source Code

  1. #1

    Thread Starter
    Lively Member Gherkin's Avatar
    Join Date
    Aug 2001
    Location
    Gherkin Land
    Posts
    65

    Get Internet Site Source Code

    Hi!

    Does any know how to get the html code from a internet site?

    Thanks!

  2. #2
    Member
    Join Date
    Jul 2001
    Posts
    36
    VB Code:
    1. Private Sub Form_Load()
    2. With Winsock1
    3.        .RemotePort = 80
    4.        .RemoteHost = [url]www.whatever.org/whatever.html[/url]
    5.        .Connect
    6.    End With
    7. End Sub
    8.  
    9. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    10.  
    11.     Dim strData As String
    12.     Dim ReturnData As String
    13.     Dim Strdata2 As String
    14.     Dim ReturnData2 As String
    15.     Winsock1.GetData strData, vbString
    16.     List1.AddItem strData
    17.  
    18. End Sub

    I suck so that probably wont work, made it up on spot.
    U'll need to make a listbox called list 1, but if you have ie, why dont u just do

    view > source
    james

  3. #3

    Thread Starter
    Lively Member Gherkin's Avatar
    Join Date
    Aug 2001
    Location
    Gherkin Land
    Posts
    65
    Thanks for replying to my post so quickly!

    I haven't tried it yet, but I will get back if it does not work.

    Thanks very much!

  4. #4

    Thread Starter
    Lively Member Gherkin's Avatar
    Join Date
    Aug 2001
    Location
    Gherkin Land
    Posts
    65
    It dosen't work. How do I get the source code?

    I forgot to answer your question. The reason I want it is so I can get some information from a web site.

    Thanks!

  5. #5
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    How about this...requires a textbox and inet control
    VB Code:
    1. Text1.Text = Inet1.OpenURL("http://www.vbforums.com")

  6. #6
    Fanatic Member
    Join Date
    Sep 2000
    Location
    UK.
    Posts
    728

    Smile Info.

    I wrote some code in this thread for downloading a web page using HTTP Protocol with the Winsock control. Check it out: http://forums.vb-world.net/showthrea...hreadid=100775

    Please, please search the forums first. This sort of question has been asked many times before...

    Hope this helps.
    Laterz
    Digital-X-Treme
    Contact me on MSN Messenger: [email protected]

    [VBCODE]Debug.Print Round(((1097) - ((55 ^ 5 + 311 ^ 3 - 11 ^ 3) _
    / (68 ^ 5))) ^ (1 / 7), 13)[/VBCODE]

  7. #7
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    Originally posted by chrisjk
    How about this...requires a textbox and inet control
    VB Code:
    1. Text1.Text = Inet1.OpenURL("http://www.vbforums.com")
    this is the code that i always use
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

  8. #8
    Matthew Gates
    Guest
    You could also use the URLDownloadToFile API function.


    VB Code:
    1. Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
    2. "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As _
    3. String, ByVal szFileName As String, ByVal dwReserved As Long, _
    4. ByVal lpfnCB As Long) As Long
    5.  
    6.  
    7.  
    8. Private Function DownloadFile(URL As String, _
    9.     LocalFilename As String) As Boolean
    10.     Dim lngRetVal As Long
    11.     lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
    12.     If lngRetVal = 0 Then DownloadFile = True
    13. End Function
    14.  
    15. '[b][u]Usage[/u][/b]
    16.  
    17. Private Sub Command1_Click()
    18.     DownloadFile "http://www.aol.com", "c:\aol.htm"
    19. End Sub

  9. #9

    Thread Starter
    Lively Member Gherkin's Avatar
    Join Date
    Aug 2001
    Location
    Gherkin Land
    Posts
    65
    Thank you all very much for your replys.

    I got it to work.

    Thanks.

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