Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP Through Proxy 1

Status
Not open for further replies.

LeanneGodney

Technical User
Mar 7, 2002
175
GB
Hi guys,

I'm trying to write code to retrieve a file from my clients ftp server. If I do it manually, I do the following:

1. Open up the command prompt
2. Type FTP proxyserver
3. Enter my username and password
4. Connect to client site by entering "user username@clientFTPSite.com"
5. Enter password
6. get "SourceFile" "DestinationFile"

This works a charm.

But I'm trying to use InternetOpen, InternetConnect and FtpGetFile. There's loads of info about this on the net, but I'm battling to get it to work with the proxy.

I'm not connecting direct to the client, I have to go through my proxy then connect using "user me@them.com pwd".

So how do I interpret that into the InternetOpen, InternetConnect and FtpGetFile functions???


Currently have:

lngINet = InternetOpen("MyFTP Control", 1, ProxyUserName, ProxyPassword, 0)
lngINetConn = InternetConnect(lngINet, ProxyServer, 0, me@ClientFTPSite.com, MyClientSitePassword, 1, 0, 0)
GetFile = FtpGetFile(lngINetConn, GetFileFullName, ResultFileFullName, False, 0, 0, 0)

Anyone done this before who can offer some insight???


THanks,
Leanne
 




Hi,

Here's code that I am using every week.
Code:
Public Sub downloadFTP()
    Dim hINetSession As Long, hSession As Long, sGetFile As String, sPutFile As String
    
    
    
    sGetFile = "/i2/prod/fp/models/mach/reports/traveler_release/Trav_Rel_DSC_" & Format(Date, "yyyy-mm-dd") & ".xls"
    
    sPutFile = ThisWorkbook.Path & "\" & "Trav_Rel_DSC_" & Format(Date, "yyyy-mm-dd") & ".xls"
    
    hINetSession = InternetOpen("MyFTPClient", 0, vbNullString, vbNullString, 0)
    
    hSession = InternetConnect(hINetSession, "prod21", "21", "reports", "reports", 1, 0, 0)
    
    If FtpGetFile( _
        hSession, _
        sGetFile, _
        sPutFile, _
        False, _
        1, _
        0, _
        0) = False Then
       MsgBox "Call to FtpGetFile Failed For " & sGetFile
    End If
End Sub

Skip,

[glasses] [red][/red]
[tongue]
 
Hi there,

Your sample code doesn't use a proxy server. This is the sum of my problem - need to get it to work through a proxy.

Leanne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top