Posts: 100
Threads: 45
Joined: Jan 2014
12-15-2021, 02:50 PM
(This post was last modified: 12-15-2021, 02:54 PM by lostruler.)
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
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")
Posts: 1,336
Threads: 61
Joined: Jul 2006
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.
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
Posts: 100
Threads: 45
Joined: Jan 2014
This worked too fine, Kevin. Thanks a lot!!