Hi,
How can i get HTML source code of page(Using WinSck)?
Ex. page: https://edit.my.yahoo.com/registration?
Very thanks :).
Printable View
Hi,
How can i get HTML source code of page(Using WinSck)?
Ex. page: https://edit.my.yahoo.com/registration?
Very thanks :).
Are you using VB6?
Yes, VB 6.0
Your first problem is you are trying to use Winsock to connect to a secure server, hense the https. I don't think you are going to get very far with this way. You would be better off using the Inet control or the WebBrowser control since they will take care of the security stuff for you and Winsock will not.
I do this, thanks both ;):
WinSck_General.Connect "edit.cn.yahoo.com", 80
Private Sub WinSck_General_Connect()
On Error Resume Next
Dim_Str_HTTPRequest = "Get /config/eval_register?" & " HTTP/1.0" & vbCrLf
Dim_Str_HTTPRequest = Dim_Str_HTTPRequest & "Host: " & WinSck_General.RemoteHost & vbCrLf
Dim_Str_HTTPRequest = Dim_Str_HTTPRequest & "Content-Type: application/x-www-form-urlencoded" & vbCrLf
Dim_Str_HTTPRequest = Dim_Str_HTTPRequest & "Connection: Keep-Alive" & vbCrLf
Dim_Str_HTTPRequest = Dim_Str_HTTPRequest & vbCrLf
Fra_StartOrCreate_TxtBx_Status.Text = "Status: Requesting data(Get)..."
WinSck_General.SendData (Dim_Str_HTTPRequest)
End Sub
Well whatever data you will get from that request will come into your DataArrival event.
If you want you can do it using this code and the usage is...
Or you can even use the WebBrowser control for this. But if your are persistent on using the Winsock Control then what ever you recieve back after sending your GET request will be done through the DataArrival method as mentioned above.Code:Private Sub Command1_Click()
CopyURLToFile "http://www.google.com", "C:\blah.txt"
End Sub
I think "WinSck" is very fastest.
The API in the example use winsock some where down the line i believe.