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

0 Members and 1 Guest are viewing this topic.

FELIX

  • Bull Frog
  • Posts: 241
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

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
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: 12912
  • London, England
Re: Read file in FPT
« Reply #2 on: March 16, 2017, 02:58:22 PM »

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
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: 12912
  • 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