[API]
CloseSocket

[INCLUDE]
Winsock
Winsock_Connect
Winsock_Send
Winsock_GetHostByName

[CODE]
Public Function Winsock_ConnectAndRequestHTTP(ByVal URL As String, Optional ByVal TimeOut As Long = 4000&) As Long
  Dim xLong1 As Long
  Dim xChar1 As String
  
  URL = Replace(URL, "\", "/")
  xLong1 = InStr(URL, "://")
  If Not xLong1 = 0& Then URL = Mid(URL, xLong1 + 3&)
  xLong1 = InStr(URL, "/")
  If xLong1 = 0& Then xLong1 = Len(xLong1) + 1&
  xChar1 = Left(URL, xLong1 - 1&)
  URL = Mid(URL, xLong1)
  If Len(URL) = 0& Then URL = "/"
  
  xLong1 = Winsock_Connect(xChar1, TimeOut)
  If xLong1 > 0& Then
    If Winsock_Send(xLong1, "GET " + URL + " HTTP/1.1" + vbCrLf + "Host: " + xChar1 + vbCrLf + vbCrLf) Then
      Winsock_ConnectAndRequestHTTP = xLong1
      Else
      Call CloseSocket(xLong1)
      End If
    End If
  End Function