Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't download Json as text
#1
Hello Guys,

I'm trying to retrieve the API results to a text file. I can open in Chrome, but I cant download it. Can you please help me?

Macro Macro295
Code:
Copy      Help
HtmlDoc d
d.InitFromWeb("https://www.cmegroup.com/CmeWS/mvc/Settlements/Futures/Settlements/310/FUT?&tradeDate=12/14/2021")
str sy=d.GetText("Body")
out sy
sy.setfile("C:\BASE\file1.txt")
#2
It seems that it is opening a download file prompt. So, it times out.
I opened the url in Internet Explorer and seen this
Best way I found around it is this

this will download it directly to a file.
Code:
Copy      Help
if(!FileExists("C:\BASE" 1))
,mkdir "Base" "C:"
str filepath.expandpath("C:\BASE\file1.txt")
int i=URLDownloadToFile(0 "https://www.cmegroup.com/CmeWS/mvc/Settlements/Futures/Settlements/310/FUT?&tradeDate=12/14/2021" filepath 0 0)
if i=0
,_s.getfile("C:\BASE\file1.txt")
,out _s
#3
This worked too fine, Kevin. Thanks a lot!!


Forum Jump:


Users browsing this thread: 1 Guest(s)