read a text file from HTTPs not using CreateObject("MSXML2.ServerXMLHTTP.3.0") (1 Viewer)

smig

Registered User.
Local time
Today, 03:09
Joined
Nov 25, 2009
Messages
2,209
Is it possible to read a text file from HTTPS not using CreateObject("MSXML2.ServerXMLHTTP.3.0") ?

though it might work well for HTTP files it will fail for HTTPS.

What I actually need is reading a small TXT file that include a version number.
reading a small and simple XML file can be an option too.

I know it's possible to download and read but I prefer not to.
Recently I moved to use URLDownloadToFile for downloading files, because of the same reason.
 

Isaac

Lifelong Learner
Local time
Yesterday, 17:09
Joined
Mar 14, 2017
Messages
8,777
A possible option.

Depending on how you're hosting the text file (url.txt, is it totally 'open', etc)

You might use Excel's text import feature to create a query definition in Excel, then modify it and write excel automation code to suit
 

isladogs

MVP / VIP
Local time
Today, 01:09
Joined
Jan 14, 2017
Messages
18,216
You're welcome
For info, I use this code in several apps to download JSON files from HTTPS as well as HTTP. It works fine.
:
Code:
  'setup the request and authorization
    Set http = New MSXML2.XMLHTTP60
    
    http.Open "GET", strURL, False
    http.Send ""
 

smig

Registered User.
Local time
Today, 03:09
Joined
Nov 25, 2009
Messages
2,209
You're welcome
For info, I use this code in several apps to download JSON files from HTTPS as well as HTTP. It works fine.
:
Code:
  'setup the request and authorization
    Set http = New MSXML2.XMLHTTP60
   
    http.Open "GET", strURL, False
    http.Send ""
what does it mean MSXML2.ServerXMLHTTP.3.0, MSXML2.XMLHTTP60 ... ?
what is the difference ?

for me it failed in some cases, so I changed to URLDownloadToFile
 

isladogs

MVP / VIP
Local time
Today, 01:09
Joined
Jan 14, 2017
Messages
18,216
Two different versions of the library reference with 6.0 being much newer and presumably with additional functionality like support for HTTPS

1611005773073.png
 

Users who are viewing this thread

Top Bottom