#154444 - 2006-01-10 04:02 PM
Re: ftp exist udf?
|
cyri
Getting the hang of it
Registered: 2005-06-27
Posts: 95
|
I tried this code. Code:
FTPget("ftp://ftp.mcafee.com/CommonUpdater/delta.ini?hash=+@date + @time","e:\delta.ini")
But it's not downloading the file now. Am I missing something?
|
Top
|
|
|
|
#154448 - 2006-01-10 05:10 PM
Re: ftp exist udf?
|
cyri
Getting the hang of it
Registered: 2005-06-27
Posts: 95
|
I'm still playing with this hash used in the first method (below). req.open("GET", "xmlprovider.php?hash=" + Math.random());
The third method (shown below) I tested and it still grabbed the old copy of the file. req.open("GET", "xmlprovider.php"); req.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"); req.send(null);
As for attempting to write a modified UDF. I think thats a bit out of my skill range. I'm not familar enough with XMLHTTP.
|
Top
|
|
|
|
#154450 - 2006-01-10 07:30 PM
Re: ftp exist udf?
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
Quote:
It has built in credentials in the task. Would this still apply?
You mean to say the task is running under a user account ? If so, might also try (as a test) a scripted DEL of temporary internet files - just as a test I mean. At least you would know for sure whether caching was the issue.
|
Top
|
|
|
|
#154451 - 2006-01-10 07:32 PM
Re: ftp exist udf?
|
cyri
Getting the hang of it
Registered: 2005-06-27
Posts: 95
|
I feel a little sheepish. I got a bit involved in some of the other posts that I didn't even try it...until now. Your reg hack worked NTDOC. Thank you for that.
Though I'm sure there is probably a way to do this within XMLHTTP as well without modifying IE settings.
|
Top
|
|
|
|
#154453 - 2006-01-10 10:43 PM
Re: ftp exist udf?
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
ok so try this POST version of FTPGet then ...
Code:
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("POST", $sURL, not 1, $sUser, $sPass) else $oFTP.Open("POST", $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
-Jaffa
|
Top
|
|
|
|
#154456 - 2006-01-10 11:53 PM
Re: ftp exist udf?
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
k, checked out the syntax and this should work for you: Code:
Function FTPgetPOST($sServer, $sFile, $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("POST", $sServer, not 1, $sUser, $sPass) else $oFTP.Open("POST", $sServer, not 1) endif if @error $ftpget=3 exit 3 endif $oFTP.setRequestHeader = "Content-Type", "application/x-www-form-urlencoded" $oFTP.Send($sFile) $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
_________________________
!download KiXnet
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 248 anonymous users online.
|
|
|