Downloading Xml link

I have a link https://members.tsetmc.com/tsev2/excel/MarketWatchPlus.aspx?d=0 that this link give me every second a execl file and i want to download this file.how can do it?

Just to be clear, there is a new Excel file on this link every second. So you would like a code that will download every new Excel file every second?

yes i want download file every second or 3 second and merge data together.

Then, you want to do is to run a scheduled script with the download.file() function. Take a look at this article:

my file is aspx and use download.file( ) can't download it. in first step i want to download it and then schedule.

When I try the following code, the file is downloaded, but I can't open it. This may be due to the fact that you can only get to this link if you sign in on the website (i.e. you need to be a member)?

download.file( url = "https://members.tsetmc.com/tsev2/excel/MarketWatchPlus.aspx", destfile = "file.xlsx")

i use this function but get an error.

Error in download.file(url = url, destfile = "file.xlsx") : 
  cannot open URL 'https://members.tsetmc.com/tsev2/excel/MarketWatchPlus.aspx?d=0'
In addition: Warning message:
In download.file(url = url, destfile = "file.xlsx") :
  URL 'https://members.tsetmc.com/tsev2/excel/MarketWatchPlus.aspx?d=0': status was 'SSL peer certificate or SSH remote key was not OK'

@saso_008 I removed the ?d=0 at the end of the link. Copy and paste my code if you want.

dont work and i think for get aspx files we must another functions.

Error in download.file(url = "https://members.tsetmc.com/tsev2/excel/MarketWatchPlus.aspx",  : 
  cannot open URL 'https://members.tsetmc.com/tsev2/excel/MarketWatchPlus.aspx'
In addition: Warning message:
In download.file(url = "https://members.tsetmc.com/tsev2/excel/MarketWatchPlus.aspx",  :
  URL 'https://members.tsetmc.com/tsev2/excel/MarketWatchPlus.aspx': status was 'SSL peer certificate or SSH remote key was not OK'

I'm not sure why but I am able to download it even though I cannot open it. But looking at the error message you get, I think my earlier suspicion was correct: 'SSL peer certificate or SSH remote key was not OK'. It seems that these excel files are supposed to be available to members only. I am not sure how to interact with this website. Maybe it has a convenient API to get data from it?

thanks @gueyenono . I can copy this file and download it without login to website and we don't have api for get data.

I see then I 'm really not sure why you are not able to download it. :frowning:
It works on my computer though.

you can download file without any error?

Yes, but for some reason I cannot open it.

you use Rstudio in windows of linux?

My operating system is Windows.

my operating system is linux(debian10) and you did not any idea or can use another way for resolve error or use another function?

I see. I am sorry, I don't know how else to help you.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.