FTP and COM_ functions

Forum help and suggestions to improve this forum.

Moderator: Rathinagiri

Post Reply
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

FTP and COM_ functions

Post 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
There's nothing you can do that can't be done...
User avatar
santy
Posts: 60
Joined: Tue Sep 25, 2012 11:19 am
Location: Ukraine, Lviv
Contact:

Re: FTP and COM_ functions

Post 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

Best regards,
Oleksandr Antypenko
xHarbour 1.2.3 , Harbour 3.x + Mingw 4.x (HMG, minigui)
https://bitbucket.org/aantypenko
https://github.com/aantypenko
User avatar
danielmaximiliano
Posts: 2611
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: FTP and COM_ functions

Post 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
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
santy
Posts: 60
Joined: Tue Sep 25, 2012 11:19 am
Location: Ukraine, Lviv
Contact:

Re: FTP and COM_ functions

Post by santy »

Thank you danielmaximiliano :)
Best regards,
Oleksandr Antypenko
xHarbour 1.2.3 , Harbour 3.x + Mingw 4.x (HMG, minigui)
https://bitbucket.org/aantypenko
https://github.com/aantypenko
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: FTP and COM_ functions

Post 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
There's nothing you can do that can't be done...
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: FTP and COM_ functions

Post by serge_girard »

I found a good solution on

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

Topic can be closed.

Thx all,

Serge
There's nothing you can do that can't be done...
Post Reply