4

not sure if anyone can help. I am programming using a language called AutoLISP....based off of LISP but with a few extras. It is used inside a program called AutoCAD.

Anyway, I have some code that can read from a text file on a web server, but I want to know how to write to the file too.....if possible.

This is what I have to read the file:

(defun c:read ()
(setq server "http://example.com.au/Folder/")
(setq SetFile "testpost.txt")
(setq Filepath (strcat server SetFile))


(setq xml (vlax-create-object "MSXML2.XMLHTTP.3.0"))
(vlax-invoke-method xml 'open "POST" Filepath :vlax-false)
(vlax-invoke-method xml 'send)
(setq strSunday (vlax-get-property xml 'responsetext))
)

Any ideas how to use the code I have to write back?

Thanks

SuperBot12
  • 77
  • 8
  • Write to your local file - or the one on the server? If you mean the server one, then try `(vla-put-property object new-value)`. – soegaard May 15 '15 at 11:21
  • thanks for the info. Yes I am trying to write to the web server. I tried the piece of code you put but that doesn't seem to work either. I am starting to assume after much research that this is not possible to do with autolisp – SuperBot12 May 15 '15 at 22:45

1 Answers1

1

You need to write something at the server that will take an HTTP request and save it. That is the semantic purpose of POST requests, but you have to write or install a program at the server to do the work. Since I know PHP, I would write a program in PHP to listen for POST requests and save the contents or certain parts of the contents. Does that make sense?

Tom Haws
  • 1,322
  • 1
  • 11
  • 23