Page 1 of 1

FTP and COM_ functions

Posted: Mon Nov 26, 2012 8:20 am
by serge_girard
Hello all,

I am new to HMG but Clippering since 1987...
I have some large applications in Clipper 5.2 and I am now rewriting most of it in HMG. All this goes very well !

But I have a problem/question: is there a way to FTP files to a website. I am now using DOS ftp and this not an
a certain/secure method. I read about COM_ functions and OPEN CONNECTION but I can't find documentation or samples.

Anybody any suggestions?

Regards and thanks,

Serge/Belgium

Re: FTP and COM_ functions

Posted: Mon Nov 26, 2012 9:37 am
by santy
Hi serge_girard,

Try hbtip library.

For ftp

Code: Select all

#require "hbtip"

PROCEDURE Main( cUrl )

   LOCAL oCon, oUrl

   oUrl := TUrl():New( cUrl )
   IF Empty( oUrl )
      ? "Invalid url " + cUrl
      ?
      QUIT
   ENDIF

   IF oUrl:cProto != "ftp"
      ? "This is a 'DELE' test for ftp."
      ? "Use an ftp address with a file that you can delete."
      ?
      QUIT
   ENDIF

   oCon := TIPClientFTP():New( oUrl )
   oCon:nConnTimeout := 20000
   ? "Connecting with", oUrl:cServer
   IF oCon:Open( cUrl )
      ? "Connection eshtablished"
      ? "Deleting", oUrl:cPath
      IF oCon:CWD( oUrl:cPath )
         ? "CWD success"
         IF oCon:Dele( oUrl:cFile )
            ? "DELE success"
         ELSE
            ? "DELE Faliure (server reply:", oCon:cReply + ")"
         ENDIF
      ELSE
         ? "CWD Faliure (server reply:", oCon:cReply + ")"
      ENDIF

      oCon:Close()
   ELSE
      ? "Can't connect with", oUrl:cServer
      IF oCon:SocketCon == NIL
         ? "Connection not initiated"
      ELSEIF hb_inetErrorCode( oCon:SocketCon ) == 0
         ? "Server sayed:", oCon:cReply
      ELSE
         ? "Error in connection:", hb_inetErrorDesc( oCon:SocketCon )
      ENDIF
   ENDIF

   ? "Done"
   ?

   RETURN


Re: FTP and COM_ functions

Posted: Mon Nov 26, 2012 1:28 pm
by danielmaximiliano
The Santy friend forgot to say that if you need to secure tasacciones have to use the library hbtip with SSL support
Openssl need to download and install in c:\openssl


if using FTPS:// need some more changes.

http://en.wikipedia.org/wiki/FTPS

Re: FTP and COM_ functions

Posted: Mon Nov 26, 2012 2:05 pm
by santy
Thank you danielmaximiliano :)

Re: FTP and COM_ functions

Posted: Mon Nov 26, 2012 2:15 pm
by serge_girard
Thx both,


In the example of Santy I get an error (IF oUrl:cProto != "ftp" -->Use an ftp address with a file that you can delete)

I made a FTP:ftp.xxxxx.xx folder.

Do I need something else?

Thx,S

Re: FTP and COM_ functions

Posted: Thu Nov 29, 2012 12:47 pm
by serge_girard
I found a good solution on

http://www.creasolgroup.com/xOraclipLan ... _f.en.html

Topic can be closed.

Thx all,

Serge