Kix FTP (Kixtart UDF)
FTP via Kix? Yes!!!
Using Microsoft.XMLHTTP and ADODB.Stream.
Usage:
FTPget("ftp_address", "target_dest_drive", "id", "password")
Code Snippet:
Function FTPget($sURL, $sTargetFile, optional $sUser, optional $sPass)
Dim $oFTP, $oStream $sUser=""+$sUser
$oFTP = CreateObject("Microsoft.XMLHTTP")
if @error
$ftpget=1
exit 1
endif
$oStream = CreateObject("ADODB.Stream")
if @error
$ftpget=2
exit 2
endif
if $sUser
$oFTP.Open("GET", $sURL, not 1, $sUser, $sPass)
else
$oFTP.Open("GET", $sURL, not 1)
endif
if @error
$ftpget=3
exit 3
endif
$oFTP.Send
$oStream.Type = 1
$oStream.Mode = 3
$oStream.open
$oStream.Write($oFTP.responseBody)
if @error
$ftpget=4
exit 4
endif
$oStream.SaveToFile($sTargetFile, 2)
if @error
$ftpget=5
exit 5
endif
$oStream.Close
EndFunction
If at first you fail, call it version 1.0
No comments:
Post a Comment