从 C++ 中的 URL 获取结果

Getting a result from a URL in C++

本文关键字:获取 结果 URL 中的 C++      更新时间:2023-10-16

我需要一些代码的裸露C++版本。 使用 Visual Studio 2017。

我的朋友想使用 c++ 从 URL 链接获取结果。 他稍后将编写.json解析器,然后他希望代码访问相同的URL域并获取相同结果中的URL。

我认为它必须是某种HTTP/HTTPS C++GET请求制造者功能,但我不确定。

查找此任务的可能模板,以及指向此项目任何必要库的链接。

libcurl(http://curl.haxx.se/libcurl/(绝对是一个很棒的HTTP/HTTPS客户端库,它具有所有可能的花里胡哨。

但还有其他类似:

  • LibHTTP (https://www.libhttp.org/(
  • 果子狸网 (https://github.com/civetweb/civetweb(
  • CPP-httplib (https://github.com/yhirose/cpp-httplib(
  • libwww (http://www.w3.org/Library/(
  • LibHTP (https://github.com/OISF/libhtp(
  • HTTP 解析器 (https://github.com/nodejs/http-parser(

已经有很多JSON解析器了。仅举几例:

  • cJSON (https://github.com/DaveGamble/cJSON(
  • UltraJSON (https://github.com/ultrajson/ultrajson(
  • JsonCpp (https://github.com/open-source-parsers/jsoncpp(
  • 卡津 (https://sourceforge.net/projects/cajun-jsonapi/(
  • 适用于现代C++的 JSON (https://github.com/nlohmann/json/(
  • RapidJSON (https://github.com/Tencent/rapidjson(
  • 小 JSON (https://github.com/rafagafe/tiny-json(
  • json.h (https://github.com/sheredom/json.h(
  • json-parser (https://github.com/udp/json-parser(
  • libfastjson (https://github.com/rsyslog/libfastjson(
  • Liblaxjson (https://github.com/andrewrk/liblaxjson(

但是那里还有更多...

由您根据哪些标准对您很重要(例如:低占用空间、性能C++ API(进行选择。