Author Topic: Read file in FPT  (Read 259 times)

0 Members and 1 Guest are viewing this topic.

FELIX

  • Newt
  • Posts: 122
Read file in FPT
« on: March 16, 2017, 12:34:23 pm »
ftp.xxxxxxxx.yyy/test.dat

Open and read file in FTP?
OK.

roy_043

  • Swamp Rat
  • Posts: 1480
  • BricsCAD 16
Re: Read file in FPT
« Reply #1 on: March 16, 2017, 02:55:33 pm »
Code - Auto/Visual Lisp: [Select]
  1. ; See: http://www.theswamp.org/index.php?topic=39491.0
  2. (defun KGA_Data_InternetServerTextGet (server / xml ret)
  3.  (vl-catch-all-apply
  4.    (function
  5.      (lambda ()
  6.        (setq xml (vlax-get-or-create-object "MSXML2.XMLHTTP.3.0"))
  7.        (vlax-invoke-method xml 'open "POST" server :vlax-false)
  8.        (vlax-invoke-method xml 'send)
  9.        (setq ret (vlax-get-property xml 'responsetext))
  10.      )
  11.    )
  12.  )
  13.  (if xml (vlax-release-object xml))
  14.  ret
  15. )

Code - Auto/Visual Lisp: [Select]
  1. (KGA_Data_InternetServerTextGet "ftp.xxxxxxxx.yyy/test.dat")

Lee Mac

  • Seagull
  • Posts: 11800
  • AutoCAD 2015 Windows 7 London, England
Re: Read file in FPT
« Reply #2 on: March 16, 2017, 02:58:22 pm »

roy_043

  • Swamp Rat
  • Posts: 1480
  • BricsCAD 16
Re: Read file in FPT
« Reply #3 on: March 16, 2017, 03:13:47 pm »
@roy, why not a "GET" request?

Code: [Select]
(LM:GETURLTEXT "http://time.nist.gov:13")                            => ERROR
(LM:GETURLTEXT "ftp://topex.ucsd.edu/pub/srtm15_plus/README.V1.txt") => ERROR
(LM:GETURLTEXT "https://www.theswamp.org/")                          => OK

Code: [Select]
(KGA_Data_InternetServerTextGet "http://time.nist.gov:13")                            => OK
(KGA_Data_InternetServerTextGet "ftp://topex.ucsd.edu/pub/srtm15_plus/README.V1.txt") => OK
(KGA_Data_InternetServerTextGet "https://www.theswamp.org/")                          => OK

Lee Mac

  • Seagull
  • Posts: 11800
  • AutoCAD 2015 Windows 7 London, England
Re: Read file in FPT
« Reply #4 on: March 16, 2017, 07:13:41 pm »
Thanks - looking back over my 'Internet Time' function, it seems I've answered my own question. :oops:

I posted the question as after a cursory review of your code, the POST just seemed illogical on the face of it when the objective was to retrieve data.

Lee