For at kunne bruge dette eksempel, skal du inkludere winsocket på dit component panel.
*********************************
Private Sub Form_Load()
Winsock1.RemoteHost = "195.249.156.141"
Winsock1.RemotePort = 80
Winsock1.Connect
End Sub
Private Sub Winsock1_Connect()
Dim strCommand As String
Dim strWebPage As String
strWebPage = "
http://www.microsoft.dk/index.asp"
strCommand = "GET " + strWebPage + " HTTP/1.0" + vbCrLf
strCommand = strCommand + "Accept: */*" + vbCrLf
strCommand = strCommand + "Accept: text/html" + vbCrLf
strCommand = strCommand + vbCrLf
Winsock1.SendData strCommand
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim webData As String
Winsock1.GetData webData, vbString
Text1.Text = Text1.Text + webData
End Sub