Aqui dejo otro:
'***************************************************************************
'Ejemplo de como descargar un archivo de internet usando el control Winsock
'***************************************************************************
'Copyright 2003-2004 SMG Software.
'***************************************************************************
Dim Data As String
Dim BytesAlreadySent As Single
Dim FILEPATHNAME
Dim Est As String
Private Sub Command1_Click()
BytesAlreadySent = 1
If Text1.Text = "" Then Exit Sub
strURL = Text1.Text
Dim Pos%, LENGTH%, NextPos%, LENGTH2%, POS2%, POS3%
Pos = InStr(strURL, "://")
LENGTH2 = Len("://")
LENGTH = Len(strURL)
If InStr(strURL, "://") Then
strURL = Right(strURL, LENGTH - LENGTH2 - Pos + 1)
End If
If InStr(strURL, "/") Then
POS2 = InStr(strURL, "/")
Dim StrFile$: StrFile = strURL
Do Until InStr(StrFile, "/") = 0
LENGTH2 = Len(StrFile)
POS3 = InStr(StrFile, "/")
StrFile = Right(strURL, LENGTH2 - POS3)
StrFile = Right(strURL, LENGTH2 - POS3)
Loop
FileName = StrFile
strURL = Left(strURL, POS2 - 1)
End If
Winsock.Connect strURL, 80
FILEPATHNAME = "C:\" & FileName
End Sub
Private Sub Command3_Click()
If Winsock.State >= 1 Then
Winsock.Close
Data = ""
BytesAlreadySent = 1
End If
Est = "1"
End Sub
Private Sub ExitMNU_Click()
If Winsock.State > 0 Then
Winsock.Close
End If
End
End Sub
Private Sub Form_Load()
Est = "1"
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If Winsock.State > 1 Then
Winsock.Close
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Winsock.State > 1 Then
Winsock.Close
End If
End Sub
Private Sub HeaderTXT_Change()
End Sub
Private Sub Label2_Click()
End Sub
Private Sub Winsock_Close()
If Est = "1" Then
MsgBox "Completado - Descargado en C"
Est = "2"
End If
End Sub
Private Sub Winsock_Connect()
On Error Resume Next
Dim strCommand As String
strCommand = "GET " + Text1.Text + " HTTP/1.0" + vbCrLf
strCommand = strCommand + "Accept: *.*, */*" + vbCrLf
strCommand = strCommand + "Referer: " & strURL & vbCrLf
strCommand = strCommand + vbCrLf
Winsock.SendData strCommand
End Sub
Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)
Winsock.GetData Data, vbString
If InStr(Data, "Content-Type:") Then
Dim Pos%, LENGTH%, HEAD$
Pos = InStr(Data, vbCrLf & vbCrLf)
LENGTH = Len(Data)
HEAD = Left(Data, Pos - 1)
Data = Right(Data, LENGTH - Pos - 3)
End If
Open FILEPATHNAME For Binary Access Write As #1
Put #1, BytesAlreadySent, Data
BytesAlreadySent = Seek(1)
Close #1
End Sub
el command1 es descargar y el command2 es detener. y colocan text de la url.
...
funciona muy bien y es 100% indetectable...
espero q les sirva