how to use curl or wget to download a text file off a website?

1

i am trying to access eoddata.com to download a list of stock prices at the end of everyday without having to do it myself manually.

the full url i am trying to access would be something like: http://eoddata.com/data/filedownload.aspx?e=AMEX&sd=20160603&ed=20160603&d=9&k=ejv5n7btwb&o=d&ea=1&p=0

I have tried doing a curl request:

When using curl

curl username:password@www.eoddata.com/data/filedownload.aspx?e=AMEX&sd=20160602&ed=20160602&d=9&k=mbywemcptq&o=d&ea=1&p=0

the return is:

[1] 5179
[2] 5180
[3] 5181
[4] 5182
[5] 5183
[6] 5184
[7] 5185
[2]   Done                    sd=20160602
[3]   Done                    ed=20160602
[4]   Done                    d=9
[5]   Done                    k=mbywemcptq
[6]-  Done                    o=d
[7]+  Done                    ea=1

with no file being downloaded. I am not sure what this means. will it not work because the url doesnt end in .txt or .zip?

i have tried adding http:// before the url and it says http host not found.

any help would be appreciated.

charles l

Posted 2016-06-07T07:06:28.817

Reputation: 11

the site needs a password? – rahuldottech – 2016-06-07T07:17:21.120

Your shell is treating the & special. (I suspect you're in Unix, and it is backgrounding the various pieces, and showing you PIDs.) Try simply surrounding your whole URL (everything after the word "curl") with quotation marks. – TOOGAM – 2016-06-07T07:22:27.157

Answers

0

You need to quote the URL, as & has special meanings in the shell (it sends the command preceding it to the background).

curl -O "http://username:password@www.eoddata.com/data/filedownload.aspx?e=AMEX&sd=20160602&ed=20160602&d=9&k=mbywemcptq&o=d&ea=1&p=0"

Burhan Khalid

Posted 2016-06-07T07:06:28.817

Reputation: 318

I have tried it with this addition just as youve alluded to. now a file downloads with the exact name (to be expected) yet under the curl request diagnostics, % Total ,% received, speed upload ... etc are all 0 and the file is empty. – charles l – 2016-06-07T07:52:17.737

That sounds like a problem with the server and not curl. Perhaps your session has expired. – Burhan Khalid – 2016-06-07T08:02:08.490