Page 2 of 4 <1234>
Topic Options
#89885 - 2002-11-30 08:37 PM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
now you can help me.
can't get this bloody thing to do nothing!
kix does not even show me the errors.

code:
FTPget("ftp://ftp.cpan.org/pub/CPAN/src/perl-5.8.0.tar.gz",@scriptdir+"\perl-5.8.0.tar.gz")
if @error "Error: " @error else "success" endif
get $

Function FTPget($sURL, $sTargetFile)
Dim $oFTP, $oStream
$oFTP = CreateObject("MSXML2.ServerXMLHTTP")
if @error exit cerror endif
$oStream = CreateObject("ADODB.Stream")
if @error exit cerror endif

$oFTP.Open("GET", $sURL, not 1)
if @error exit cerror endif
$oFTP.Send

$oStream.Type = 1
$oStream.Mode = 3
$oStream.open
$oStream.Write($oFTP.responseBody)
if @error exit cerror endif
$oStream.SaveToFile($sTargetFile, 2)
if @error exit cerror endif
$oStream.Close
EndFunction

function Cerror(optional $)
$Cerror = @error
$=0+$
$Cerror=dectohex($Cerror)
$Cerror=right($Cerror,4)
$_nul=execute("$$Cerror=&$Cerror")
if $ _translate($Cerror)
$_nul=execute("$$Cerror='@serror'")
endif
endfunction
function _translate($)
exit $
endfunction

_________________________
!

download KiXnet

Top
#89886 - 2002-11-30 08:40 PM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
btw, I know that we should probably use timeout value with that object but as long as there is something wrong in such way that I can see nothing (kix just closes without error), there is no use even trying to implement anything more...
_________________________
!

download KiXnet

Top
#89887 - 2002-11-30 09:08 PM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
thanks kent, will post into UDF if you don't mind.
final code which works without xmlhttp-sdk:
code:
Function FTPget($sURL, $sTargetFile)
Dim $oFTP, $oStream
$oFTP = CreateObject("Microsoft.XMLHTTP")
if @error ?"ftp init:" cerror endif
$oStream = CreateObject("ADODB.Stream")
if @error ?"ado init:" cerror endif

$oFTP.Open("GET", $sURL, not 1)
if @error ?"ftp open:" cerror endif
$oFTP.Send

$oStream.Type = 1
$oStream.Mode = 3
$oStream.open
$oStream.Write($oFTP.responseBody)
if @error ?"ado write:" cerror endif
$oStream.SaveToFile($sTargetFile, 2)
if @error ?"ado save:" cerror endif
$oStream.Close
EndFunction

_________________________
!

download KiXnet

Top
#89888 - 2002-11-30 09:40 PM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
is this ok?
http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=12;t=000312
_________________________
!

download KiXnet

Top
#89889 - 2002-12-01 07:32 AM Re: FTP via InetCtls.Inet.1
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
I would like to see authentication methods implemented..

That is a UserID and password..

Not only a FTPGet but FTPPut too.

Kent

[ 01. December 2002, 07:33: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#89890 - 2002-12-01 07:38 AM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
eh, put definitely needs auth but don't have any place to test for auth connections.
neither put.
would need sftp for that.
_________________________
!

download KiXnet

Top
#89891 - 2002-12-02 08:01 AM Re: FTP via InetCtls.Inet.1
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Jooel,

It seems that I am really close with this..

I have tried encoding with image/jpeg too.

code:
 BREAK ON
; -- http://support.microsoft.com/default.aspx?scid=kb;EN-US;q298108
; -- http://support.microsoft.com/default.aspx?scid=kb;EN-US;q296713
$user = "kdyer"
$password = "password"
$address = "ftp://ftpsite"
$rdir = "/kdyer"
$file = "C:\untitled1.jpg"
$ftpobj = CreateObject("microsoft.xmlhttp")
IF @error <> 0
?@error
SLEEP 2
EXIT 1
ENDIF

$ftpobj.open("PUT", $address, FALSE, $user,$password)

IF $file <> ""
; -- check to insure that you have the right encoding
;application/x-www-form-urlencoded
;image/gif
;image/x-xbitmap
;image/jpeg
;image/pjpeg;
;application/vnd.ms-powerpoint;
;application/vnd.ms-excel
;application/msword
;*/*
$ftpobj.setrequestheader = "Content-Type", "*/*"
$ftpobj.send $file
ENDIF
$ftpobj = 0

Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#89892 - 2002-12-02 08:40 AM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
does the put work?
I thought that it only had get and post.
(like in checkers load.udf) [Wink]
_________________________
!

download KiXnet

Top
#89893 - 2002-12-02 11:29 PM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
kent, any update?

I've been thinking of using http-object as framework for kixtart-sockets so any update on these are helpfull.
_________________________
!

download KiXnet

Top
#89894 - 2002-12-03 02:24 AM Re: FTP via InetCtls.Inet.1
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Will look into this app this evening. Was busy trying to sort out a Citrix Printing issue today.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#89895 - 2002-12-03 02:25 AM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
huh, thought america had received nuclear blast or something...
so silent...
_________________________
!

download KiXnet

Top
#89896 - 2002-12-03 02:38 AM Re: FTP via InetCtls.Inet.1
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
More like nuclear winter here with -31°C low tonight. {brrr}
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#89897 - 2002-12-03 02:41 AM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hehee.
http://www.fmi.fi/saa/paikalli.html?neito=1&kunta=Jyväskylä

and it's night time, meaning that most likely day is warmer [Big Grin]

anyway, that should be a reason to post more.
_________________________
!

download KiXnet

Top
#89898 - 2002-12-03 02:48 AM Re: FTP via InetCtls.Inet.1
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Jooel,
Busy carrying armloads of firewood to keep the homefire burning.

Kent,
Have you tried the 6.3x client with the new universal printer?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#89899 - 2002-12-03 02:53 AM Re: FTP via InetCtls.Inet.1
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Les,

We have the new client.. It is not that we cannot print, but the Admin that put the Application on the server, you cannot print Management Reports from it.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#89900 - 2002-12-03 02:55 AM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
stupid admins, I never seen one that has any brains left [Wink]
_________________________
!

download KiXnet

Top
#89901 - 2002-12-03 09:27 AM Re: FTP via InetCtls.Inet.1
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
{Edit - Corrected the GET/POST}
Well..

I can get it to draw a pretty html doc, but not post. [Confused]

code:
 BREAK ON
;;Dim $binaryContent
; -- http://support.microsoft.com/default.aspx?scid=kb;EN-US;q298108
; -- http://support.microsoft.com/default.aspx?scid=kb;EN-US;q296713
; -- http://support.microsoft.com/support/kb/articles/Q237/9/06.ASP
; -- http://www.bibit.com/asp_example_source_documentation.html
$user = "uid"
$password = "pass"
$address = "ftp://site.com/kdyer"
$rdir = "/kdyer"
$file = "C:\untitled1.jpg"
$ftpobj = CreateObject("microsoft.xmlhttp")
IF @error <> 0
?@error
SLEEP 2
EXIT 1
ENDIF

;;$ftpobj.open("POST", $address, FALSE, $user, $password)

; -- http://www.planet-source-code.com/xq/ASP/txtCodeId.5746/lngWId.1/qx/vb/scripts/ShowCode.htm
$ftpobj.open("GET",$address,not 1)
$ftpobj.send
$strCookie = $ftpobj.getResponseHeader("set-cookie")
$strCookie = Left($strCookie, InStr($strCookie, ";") - 1)
;better check the feedback
$testresl = $ftpobj.responseText
?$testresl
;do the actual send
$ftpobj.open("POST", $address+$rdir, not 1, $user, $password)
$ftpobj.setRequestHeader("Cookie", $strCookie)
;we need to do it a second time due to K
; B article Q234486.
$ftpobj.setRequestHeader("Cookie", $strCookie)
$ftpobj.setrequestheader("MIME-Version", "1.0")
$ftpobj.setRequestHeader("Depth", "0")
; -- Think we need to do something like
; -- http://support.microsoft.com/default.aspx?scid=kb;en-us;Q298108
; -- Re. Lvarbin
;$ftpobj.send($file) ; -- If we comment out this line we can see the site
$ftpobj.send $file
$testres = $ftpobj.responseText ; -- this actually draws the FTP Site :)
?$testres

?"Press a key"
get $

I am pretty trashed.. Time for rest..

Added in a note about Lvarbin: where I think we need to convert to binary data before posting.

Hmmm..

Kent

[ 03. December 2002, 09:39: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#89902 - 2002-12-03 09:33 AM Re: FTP via InetCtls.Inet.1
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
for correct syntax you should check load.udf
_________________________
!

download KiXnet

Top
#89903 - 2002-12-03 09:40 AM Re: FTP via InetCtls.Inet.1
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Fixed..

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#89904 - 2002-12-04 04:50 PM Re: FTP via InetCtls.Inet.1
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
With the following code, I am getting the following error message:
quote:

-2147352567 Binary err

Here is the code..

code:
BREAK ON
Dim $oStream
; -- http://support.microsoft.com/default.aspx?scid=kb;EN-US;q298108
; -- http://support.microsoft.com/default.aspx?scid=kb;EN-US;q296713
; -- http://support.microsoft.com/support/kb/articles/Q237/9/06.ASP
; -- http://www.bibit.com/asp_example_source_documentation.html
$address = "site.com"
$rdir = "/kdyer/kdyer"
$user = "kdyer"
$password = "pass"
$file = "C:\cr.dbf"
$ftpobj = CreateObject("microsoft.xmlhttp")
$oStream = CreateObject("ADODB.Stream")
; -- Convert to binary
$oStream.Type = 1 ; adTypeBinary
;;$oStream.Type = 2 ; adTypeText
;$bFileData = $oStream.LoadFromFile($file)
$oStream.LoadFromFile($file)
$oStream.open
IF @error <> 0
?@error " Binary err"
get $
EXIT 1
ENDIF

;;$ftpobj.open("POST", $address, FALSE, $user, $password)

; -- http://www.planet-source-code.com/xq/ASP/txtCodeId.5746/lngWId.1/qx/vb/scripts/ShowCode.htm
$ftpobj.open("GET",$address,not 1)
$ftpobj.send
$strCookie = $ftpobj.getResponseHeader("set-cookie")
$strCookie = Left($strCookie, InStr($strCookie, ";") - 1)
;better check the feedback
$testresl = $ftpobj.responseText
?$testresl
;do the actual send
$ftpobj.open("POST", $address+$rdir, not 1, $user, $password)
$ftpobj.setRequestHeader("Cookie", $strCookie)
;we need to do it a second time due to K
; B article Q234486.
$ftpobj.setRequestHeader("Cookie", $strCookie)
$ftpobj.setrequestheader("MIME-Version", "1.0")
$ftpobj.setRequestHeader("Depth", "0")
; -- Think we need to do something like
; -- http://support.microsoft.com/default.aspx?scid=kb;en-us;Q298108
; -- Re. Lvarbin
;$ftpobj.send($file) ; -- If we comment out this line we can see the site
$ftpobj.send($bFileData)
$testres = $ftpobj.responseText ; -- this actually draws the FTP Site :)
?$testres

?"Press a key"
get $

Thinking some coversion may need to be done..

code:
;ref - http://cwashington.netreach.net/depo/view.asp?Index=622&ScriptType=vbscript
Function decimalToBinary($intDecimal)
$strBinary = ""
$intDecimal = cInt($intDecimal)
While ($intDecimal > 1)
$lngNumber1 = $intDecimal / 2
$lngNumber2 = Fix($lngNumber1)
If ($lngNumber1 > $lngNumber2)
$strDigit = "1"
Else
$strDigit = "0"
EndIf
$strBinary = $strDigit + $strBinary
$intDecimal = Fix($intDecimal / 2)
Loop
$strBinary = "1" & $strBinary
While Len($strBinary) < 8
$strBinary = "0" + $strBinary
Loop
$binString = $strBinary
EndFunction

Any insights?

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
Page 2 of 4 <1234>


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 320 anonymous users online.
Newest Members
MaikSimon, kvn317, kixtarts2025, SERoyalty, mytar
17872 Registered Users

Generated in 0.406 seconds in which 0.318 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org