How to load a .CSV file from a web server?

Is there anyone with an example on how to load a .csv file from a server?
Something similar to what Yahoo Finance does with the stock prices and then put it in a file.
I am new to Objective C/ cocoa so any code examples are more than welcome.

thank you for you help.

Hugh

Three lines?

Hi Hugh,
Cocoa makes this very easy.

NSURL *url = [NSURL URLWithString:@"http://something.to.download.com/some_file.csv"];
NSData *data = [NSData dataWithContentsOfURL:url];
[data writeToFile:@"/Users/drew/Desktop/local.csv" atomically:YES];

There are more efficient ways to do it, using NSURLDownload and NSURLRequest, but the code above is probably the simplest way to do it.

If you want to parse the CSV file, there is a tutorial I wrote a while back that shows how.

Drew

---------------------------
Drew McCormack
http://www.maccoremac.com
http://www.macanics.net
http://www.macresearch.org

Hi Drew, sorry for not

Hi Drew,

sorry for not getting back to you earlier.
This is so easy, asap I have some time I will see what is the difference using NSURLDownload and will try to make a little tutorial for others.

Thank you for your help, great.

Hugh