Hi!
Does any know how to get the html code from a internet site?
Thanks!
Printable View
Hi!
Does any know how to get the html code from a internet site?
Thanks!
VB Code:
Private Sub Form_Load() With Winsock1 .RemotePort = 80 .RemoteHost = [url]www.whatever.org/whatever.html[/url] .Connect End With End Sub Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) Dim strData As String Dim ReturnData As String Dim Strdata2 As String Dim ReturnData2 As String Winsock1.GetData strData, vbString List1.AddItem strData 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
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!
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!
How about this...requires a textbox and inet controlVB Code:
Text1.Text = Inet1.OpenURL("http://www.vbforums.com")
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
this is the code that i always useQuote:
Originally posted by chrisjk
How about this...requires a textbox and inet controlVB Code:
Text1.Text = Inet1.OpenURL("http://www.vbforums.com")
You could also use the URLDownloadToFile API function.
VB Code:
Private Declare Function URLDownloadToFile Lib "urlmon" Alias _ "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As _ String, ByVal szFileName As String, ByVal dwReserved As Long, _ ByVal lpfnCB As Long) As Long Private Function DownloadFile(URL As String, _ LocalFilename As String) As Boolean Dim lngRetVal As Long lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0) If lngRetVal = 0 Then DownloadFile = True End Function '[b][u]Usage[/u][/b] Private Sub Command1_Click() DownloadFile "http://www.aol.com", "c:\aol.htm" End Sub
Thank you all very much for your replys.
I got it to work.
Thanks.