FTP and COM_ functions

Forum help and suggestions to improve this forum.

Moderator: Rathinagiri

Post Reply
User avatar
serge_girard
Posts: 2091
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 432 times
Been thanked: 92 times
Contact:

FTP and COM_ functions

Post by serge_girard » Mon Nov 26, 2012 8:20 am

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

User avatar
santy
Posts: 60
Joined: Tue Sep 25, 2012 11:19 am
Location: Ukraine, Lviv
Contact:

Post by santy » Mon Nov 26, 2012 9:37 am

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: 2081
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 114 times
Been thanked: 15 times
Contact:

Post by danielmaximiliano » Mon Nov 26, 2012 1:28 pm

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
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.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:

Post by santy » Mon Nov 26, 2012 2:05 pm

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: 2091
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 432 times
Been thanked: 92 times
Contact:

Post by serge_girard » Mon Nov 26, 2012 2:15 pm

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

User avatar
serge_girard
Posts: 2091
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 432 times
Been thanked: 92 times
Contact:

Post by serge_girard » Thu Nov 29, 2012 12:47 pm

I found a good solution on

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

Topic can be closed.

Thx all,

Serge

Post Reply