I want to download a file from a URL, this one : http://download.finance.yahoo/d/quotes.csv?s=YHOO+GOOG+MSFT&f=sl1d1t1c1hgvbap2 When i go on my browser and input this URL in my browser, the file is automatically downloaded as it should. What I want is to download this file without going on my browser using a program in C language, I need this type of information for a financial project. I tried to download the file using libcurl but libcurl downloads the HTML page corresponding to this URL which is empty of course because the only thing this URL does is start a download. I suppose this URL is the way int a HTTP server of some kind but I am completely lost as to how to get this file.
Thank you all in advance for your time and help, please if you can help by explaining or even better with C code feel free to do so and don't be afraid to be too precise.
Use
libcurl
, and see this examples page.If you want to get it to work, make it work with the command line
curl
too, and use the--libcurl
option. I suspect the problem might be more to do with javascript, cookies, a login or whatever. All these are soluble, but play with the command line to get it to work. My diagnosis here is that your URL is missing.com
afteryahoo
.For instance:
produces the output to screen:
and produces the code: