Hi,

I have an URL like below.

When typing that in explorer, that will let you download a .csv file.

I simply wonder how you can do this in code instead. Reach the below URL and download this file to C:/ ?

string getURLfile = "http://ichart.finance.yahoo.com/table.csv?s=MSFT";

string savePath = "C:/"

//How to save this file to C:/ ?

If it were only that easy! You need code that can determine which computer to talk to (given a URL), open a socket connection to that computer, make a request for the contents of a specific file, read the contents over the socket connection, and write the contents into a file on the local filesystem. Luckily, you're not alone, and there are various existing packages that do all the dirty-work for you. Take a look at libcurl.

This is really hard tast. You should try AutoIt, because it has a capability to read websites without any libraries -- its all build in.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.