TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: josan on September 02, 2013, 01:53:18 PM

Title: Read file from internet
Post by: josan on September 02, 2013, 01:53:18 PM
I need to read a file located on a web server. "https://www.dropbox.com/s/uyrkr4ocpzutijq/Hola.txt".
After searching and find some codes the result is not as expected as in the examples you can read the data that really in the content of the file but in my case not possible.

It will be the destination server?
Thanks for your help ...
 
Example: (http://www.theswamp.org/index.php?topic=39663.msg449737#msg449737)
Code: [Select]
(defun vk_GetRemoteText (RemoteFileName / objHTTP Result)
    (if (setq objHTTP (vlax-create-object "WinHTTP.WinHTTPRequest.5.1"))
        (progn (setq
                   Result (vl-catch-all-apply
                              (function
                                  (lambda ()
                                      (vlax-invoke-method
                                          objHTTP       "Open"
                                          "GET"         RemoteFileName
                                          :vlax-false
                                         )
                                      (vlax-invoke objHTTP "Send")
                                      (vlax-get-property objHTTP "ResponseText")
                                  )
                              )
                          )
               )
               (vlax-release-object objHTTP)
               (if (not (vl-catch-all-error-p Result))
                   Result
               )
        )
    )
)
;;;(vk_GetRemoteText "http://www.opendcl.com/version/version.txt")
;;;(vk_GetRemoteText "https://www.dropbox.com/s/uyrkr4ocpzutijq/Hola.txt")
Title: Re: Read file from internet
Post by: VovKa on September 02, 2013, 03:07:46 PM
Code: [Select]
(vk_GetRemoteText "http://dl.dropboxusercontent.com/s/uyrkr4ocpzutijq/Hola.txt")
Title: Re: Read file from internet
Post by: josan on September 02, 2013, 05:43:54 PM
Thanks very friendly ...

Solved!
Title: Re: Read file from internet
Post by: cadplayer on September 09, 2013, 03:09:03 AM
the read-code is great! If you share files with "dropbox" can you see, which computer sharing your files ?
My idea is, to create a license-file in dropbox and then share them with my collegues.
Title: Re: Read file from internet
Post by: cadplayer on November 25, 2013, 03:10:22 AM
Have the "WinHTTP.WinHTTPRequest.5.1" interface possibility to load a dll from dropbox too?
Title: Re: Read file from internet
Post by: VovKa on November 25, 2013, 07:11:21 AM
http://www.theswamp.org/index.php?topic=33750.msg391249#msg391249
Title: Re: Read file from internet
Post by: snownut2 on November 25, 2013, 08:12:39 AM
Have the "WinHTTP.WinHTTPRequest.5.1" interface possibility to load a dll from dropbox too?

Dirk,

I have tried to see who has downloaded files from DropBox, I did not find it possible.  Seems from your post here it is possible, care to share how.

Bruce
Title: Re: Read file from internet
Post by: FELIX on May 24, 2020, 09:17:27 PM
I need to read a file located on a web server. "https://www.dropbox.com/s/uyrkr4ocpzutijq/Hola.txt".
After searching and find some codes the result is not as expected as in the examples you can read the data that really in the content of the file but in my case not possible.

It will be the destination server?
Thanks for your help ...
 
Example: (http://www.theswamp.org/index.php?topic=39663.msg449737#msg449737)
Code: [Select]
(defun vk_GetRemoteText (RemoteFileName / objHTTP Result)
    (if (setq objHTTP (vlax-create-object "WinHTTP.WinHTTPRequest.5.1"))
        (progn (setq
                   Result (vl-catch-all-apply
                              (function
                                  (lambda ()
                                      (vlax-invoke-method
                                          objHTTP       "Open"
                                          "GET"         RemoteFileName
                                          :vlax-false
                                         )
                                      (vlax-invoke objHTTP "Send")
                                      (vlax-get-property objHTTP "ResponseText")
                                  )
                              )
                          )
               )
               (vlax-release-object objHTTP)
               (if (not (vl-catch-all-error-p Result))
                   Result
               )
        )
    )
)
;;;(vk_GetRemoteText "http://www.opendcl.com/version/version.txt")
;;;(vk_GetRemoteText "https://www.dropbox.com/s/uyrkr4ocpzutijq/Hola.txt")

This function has stopped working and returns an expired certificate message. Does anyone know how to update?
Title: Re: Read file from internet
Post by: MickD on May 24, 2020, 09:40:50 PM
I just manually checked the link for the Hola.txt and got a 404 (not found), perhaps they moved the file or removed it altogether.
Title: Re: Read file from internet
Post by: FELIX on May 24, 2020, 10:30:59 PM
Solved, the system I was testing is that the certificate has expired.
Title: Re: Read file from internet
Post by: navsun on July 07, 2020, 01:10:49 AM
Good ajax for lisp language, can it run asynchronously?