Vern Jensen
Vern Jensen

Reputation: 3580

How to get data from URL using Windows and C?

To open a URL in the user's web browser is easy enough:

ShellExecuteA(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);

What do I call instead to retrieve data from a website using a given URL? On the Mac, I'd use:

URLSimpleDownload(url, NULL, newDataH, 0, NULL, NULL);

It stores in the newDataH handle the data retrieved from url. Easy enough. Is there an equivalent for this on Windows?

Upvotes: 2

Views: 608

Answers (3)

Dan Esparza
Dan Esparza

Reputation: 28385

You're probably looking for the InternetReadFile function in WinINet.

Here is a nice list of common functions in that API: Common functions

Upvotes: 2

Lie Ryan
Lie Ryan

Reputation: 64933

just use the libcurl library and your problem is solved for every platform on earth

Upvotes: 1

Harry Johnston
Harry Johnston

Reputation: 36348

Yes. See the Windows HTTP Services documentation at MSDN.

Upvotes: 0

Related Questions