开发者

Download File from Web C++ (with winsock?)

开发者 https://www.devze.com 2022-12-29 08:52 出处:网络
I need to download files/read strings from a specified url in C++. I\'ve done some research with this, cURL seems to be the most popular method. Also, I\'ve used it before in PHP. The problem with cUR

I need to download files/read strings from a specified url in C++. I've done some research with this, cURL seems to be the most popular method. Also, I've used it before in PHP. The problem with cURL is that the lib is huge, and my file has to be small. I think you can do it with winsock, but I can't find any simple examples. If you have a simple winsock example, a light cURL/Something else, or anything that could get the开发者_如何学Go job done. I would greatly appreciated. Also, I need this to work with native C++.


I can repeat me answer Is it possible to handle proxies at socket level? (see also comments) about two important interfaces Windows Internet (WinINet) API and Windows HTTP Services (WinHTTP). An important restriction of WinINet is that WinINet should be not used in a service (only in GUI app.) because of possible dialogs.


you should try WinInet: this library is part of Windows operating system, and allows to download a resource identified by an URL, using either HTTP or FTP.

if you are using HTTP, you might find the InternetOpenUrl() function useful.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号