Reputation: 31
So I have a problem. I want to design a program which pulls a CSV file from a certain website automatically. The thing is, I have no idea how to do so. It seems that the button which is used to download the CSV file doesn't actually point that file, but rather points to a function that does its thing and returns a CSV file. How can I pull this CSV file from the website? Apparently this has something to do with a servlet but I'm not quite sure. Thanks
Edit: It seems that there isn't really a link like bla.com/.../myfile.csv but rather bla.com/.../getReport.do and regardless of what I input into the text boxes which are provided on the website, the link stays as bla.com/.../getReport.do. The problem I have is that I can't just use the standard IO libraries in Java to download the csv file because I have no idea how to actually get the file without manually downloading it.
Upvotes: 0
Views: 412
Reputation: 1332
To send the output to a file... add >file.txt to the end of the command.
curl 'http://app.toronto.ca/tmmis/getAdminReport.do' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8' -H 'Referer: http://app.toronto.ca/tmmis/getAdminReport.do' -H 'Origin: http://app.toronto.ca' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' --data 'function=getMemberVoteReport&download=csv&page=0&itemsPerPage=50&sortBy=&sortOrder=&exportPublishReportId=2&termId=6&memberId=2&decisionBodyId=0&fromDate=2014-12-31&toDate=2016-05-10' --compressed > file1.txt
Upvotes: 1