Well, a few things:
(1) Option Explicit in the Form Declaration Section
(2) If you're going to play with HTTP, then you'll need to look at the RFC ( http://www.w3.org/Protocols/rfc2616/rfc2616.html)
Specifically, with your code you need to
(1) Indicate that you want index.html in the GET
(2) Indicate the Host you intend to get it from
(3) Terminate the request with two vbCrLfs
eg
Code:
Option Explicit
Private Sub Form_Load()
Text2.Text = "GET /index.html HTTP/1.1" & vbCrLf & _
"Host: www.google.com" & vbCrLf & vbCrLf
Winsock1.RemotePort = 80
Winsock1.RemoteHost = "www.google.com"
Winsock1.Connect
End Sub
Private Sub Winsock1_Close()
Text1.Text = Text1.Text & "Connection Closed" & vbCrLf
End Sub
Private Sub Winsock1_Connect()
Text1.Text = Text1.Text & "Connected " & vbCrLf
Winsock1.SendData Text2.Text
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
Winsock1.GetData strData, vbString
Text1.Text = Text1.Text & strData
End Sub
|
__________________
semel insanivimus omnes
S Data in context = Information, S Information in context = Knowledge, S Knowledge in context = Experience
S Experience in context = Wisdom= Data
|