从 Web C++ 下载文件(用winsock?)

发布于 2024-08-31 04:24:38 字数 209 浏览 2 评论 0原文

我需要从 C++ 中的指定网址下载文件/读取字符串。我对此做了一些研究,cURL 似乎是最流行的方法。另外,我以前在 PHP 中使用过它。 cURL 的问题是库很大,而我的文件必须很小。我认为你可以用winsock来做到这一点,但我找不到任何简单的例子。如果你有一个简单的winsock示例,一个简单的cURL/其他东西,或者任何可以完成工作的东西。我将不胜感激。另外,我需要它与本机 C++ 一起使用。

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 job done. I would greatly appreciated. Also, I need this to work with native C++.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

生生不灭 2024-09-07 04:24:38

我可以重复我的答案 是否可以处理套接字级别的代理?(另请参阅注释)有关两个重要接口 Windows Internet (WinINet) API 和 Windows HTTP 服务 (WinHTTP)。 WinINet 的一个重要限制是,由于可能出现对话框,WinINet 不应在服务中使用(仅在 GUI 应用程序中)。

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.

泪冰清 2024-09-07 04:24:38

你应该尝试WinInet:这个库是 Windows 操作系统的一部分,允许使用 HTTP 或 FTP 下载由 URL 标识的资源。

如果您使用 HTTP,您可能会找到 InternetOpenUrl() 函数很有用。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文