首页 > 解决方案 > 使用 C++ 的 HTTP 请求

问题描述

我需要向服务器 (www.google.com) 发送 HTTP 请求并获得响应。所有这些我都是用 C++ 实现的,我需要一个最小尺寸的库。我尝试在 Visual Studio 中连接 curl、cpr,但没有成功。PS我是C ++的新手。谢谢大家 :D

标签: c++visual-studiohttpserver

解决方案


我如何在 VS 中安装 curl

我建议你可以尝试使用 vcpkg 来安装 curl:

1,从: https ://github.com/microsoft/vcpkg/archive/2019.08.zip获取 vcpkg并将其解压缩到您选择的文件夹(例如C:\vcpkg\

2、打开VS 2017的开发者命令提示符(见Windows开始菜单或%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\Visual Studio 2017\Visual Studio Tools\),cd然后C:\vcpkg\

3、运行bootstrap-vcpkg.bat

4、运行vcpkg.exe integrate install

5、运行vcpkg.exe install curl

6,然后你可以尝试使用。

更多详情,我建议你可以参考链接: https ://stackoverflow.com/a/54680718/11872808


推荐阅读