Beginner Problem with curl

Hi,

i’m a beginner in applescript, so i think the problem is very easy to solve.
I am trying to download quotes from Yahoo finance and save the csv file, which will be provided.
So my script looks like that:

set a to “http://finance.yahoo.com/d/quotes.csv?s=IBM,DELL,DIA,AAPL&f=sl1d1t1c1ohgv&e=.csv
set b to “/Users/stefan/downloads”
set c to “quotes”

do shell script “Curl” & a & “-o/Users/stefan/downloads/” & c & “.csv”

But i dont get an result.

What is wrong with the script?

Best regards

steti

Hi,

a few problems:
¢ The URL to be downloaded must come after the options (-o)
¢ The parameters must be separated by spaces
¢ The name of the executable (curl) must start with a lowercase letter


set a to "http://finance.yahoo.com/d/quotes.csv?s=IBM,DELL,DIA,AAPL&f=sl1d1t1c1ohgv&e=.csv"
set b to POSIX path of (path to downloads folder)
set c to "quotes"

do shell script "curl  -o " & quoted form of (b & c & ".csv") & space & a

Hello Stefan,

thank you very much for your answer.
But the result is not what i expected.

The result is :""http://download.finance.yahoo.com/d/quotes.csv?s=IBM,DELL,DIA,AAPL"."
instead of “IBM 174.87 9/30/2011 4:00pm -4.30 176.01 178.27 174.75 7851584
DELL 14.14 9/30/2011 4:00pm -0.73 14.69 14.82 14.14 25331184
DIA 108.93 9/30/2011 4:00pm -2.45 109.81 111.16 108.87 10346236
AAPL 381.32 9/30/2011 4:00pm -9.25 387.12 388.89 381.18 19579888”

Thats the result what you get when you put the url into an web-browser.

What else can i do to get the result above?

Best regards

Stefan

the site gets redirected, to follow the redirection add the -L switch, and the URL must be escaped


set a to "http://finance.yahoo.com/d/quotes.csv?s=IBM,DELL,DIA,AAPL&f=sl1d1t1c1ohgv&e=.csv"
set b to POSIX path of (path to downloads folder)
set c to "quotes"

do shell script "curl  -L -o " & quoted form of (b & c & ".csv") & space & quoted form of a


Aaaaahhhhh,

now it works perfect.

Thanks a lot.

Best Regards

Stefan