Inet sert a faire des opérations sur un ftp :Lister, telecharger, uploader, renomer, etc....(Commande Execute), ou mm a recuperer le code src d'une page web ou txt, etc....
Voici un exemple pour se connecter a un ftp, tiré de Msdn :
Protocol Property (Internet Transfer Control) Example
This example shows how you can set the Protocol property to specify what transfer protocol the Internet Transfer Control will use. In the example, the URL property is initially set to an address without a protocol. By setting the Protocol property to icFTP, you not only specify the transfer protocol, but change the URL property as well, as the MsgBox call shows. Conversely, if you change the URL property and include a protocol (here, http://), the Protocol property is updated automatically.
Private Sub showProtocol_Click()
Inet1.URL = "example.microsoft.com"
Inet1.Protocol = icFTP ' Sets protocol explicitly
' MsgBox will display "ftp://example.microsoft.com"
MsgBox "URL = " & Inet1.URL
' Changes URL by including a protocol directly in URL
Inet1.URL = "http://example.microsoft.com"
' MsgBox now shows protocol as 4 (icFTP) MsgBox "URL " & Inet1.URL & ", Protocol " & Inet1.Protocol
End Sub
PS: Sachant que pour un ftp perso :
Inet1.url="ftp://user:pass@serveur"
Toujours tiré de Msdn qq exemple de la méthode execute :
Execute Method Example
The example shows a series of common FTP operations using the Execute method. The example assumes that three TextBox controls exist on the form. The first, txtURL contains the URL of the FTP server. The second, txtRemotePath, contains additional information needed by the particular command. The third, txtResponse, contains the response of the server.
Private Sub cmdChangeDirectory_Click()
' Change directory to txtRemotePath.
Inet1.Execute txtURL.Text, "CD " & _
txtRemotePath.Text
End Sub
Private Sub cmdDELETE_Click()
' Delete the directory in txtRemotePath.
Inet1.Execute txtURL.Text, "DELETE " & _
txtRemotePath.Text
End Sub
Private Sub cmdDIR_Click()
Inet1.Execute txtURL.Text, "DIR FindThis.txt"
End Sub
Private Sub cmdGET_Click()
Inet1.Execute txtURL.Text, _
"GET GetThis.txt C:\MyDocuments\GotThis.txt"
End Sub
Private Sub cmdSEND_Click()
Inet1.Execute txtURL.Text, _
"SEND C:\MyDocuments\Send.txt SentDocs\Sent.txt"
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
' Retrieve server response using the GetChunk
' method when State = 12.
Dim vtData As Variant ' Data variable.
Select Case State
' ... Other cases not shown.
Case icError ' 11
' In case of error, return ResponseCode and
' ResponseInfo.
vtData = Inet1.ResponseCode & ":" & _
Inet1.ResponseInfo
Case icResponseCompleted ' 12
Dim vtData As Variant
Dim strData As String
Dim bDone As Boolean: bDone = False
' Get first chunk.
vtData = Inet1.GetChunk(1024, icString)
DoEvents
Do While Not bDone
strData = strData & vtData
' Get next chunk.
vtData = Inet1.GetChunk(1024, icString)
DoEvents
If Len(vtData) = 0 Then
bDone = True
End If
Loop
txtData.Text = strData
End Select
End Sub
Pour ce qui est de récuperer le code src d'un page Html ou le contenu d'un fichier txt par exemple :
<code>
Dim LaSource as string
LaSource=inet1.openurl "http://www.url.com/fichier.txt"
Ps: Inet est assez difficile a utiliser, et en plus je le trouve assez instable, mais pour un soft perso c'est une bonne solution!!!
Pour plus de sureté, il vaut mieux utiliser winsock!!! mais ce n'est que mon avis!!!!
++