How do you make a HTTP request with C++?

后端 未结 22 2920
有刺的猬
有刺的猬 2020-11-22 06:25

Is there any way to easily make a HTTP request with C++? Specifically, I want to download the contents of a page (an API) and check the contents to see if it contains a 1 o

22条回答
  •  猫巷女王i
    2020-11-22 07:04

    Updated answer for April, 2020:

    I've had a lot of success, recently, with cpp-httplib (both as a client and a server). It's mature and its approximate, single-threaded RPS is around 6k.

    On more of the bleeding edge, there's a really promising framework, cpv-framework, that can get around 180k RPS on two cores (and will scale well with the number of cores because it's based on the seastar framework, which powers the fastest DBs on the planet, scylladb).

    However, cpv-framework is still relatively immature; so, for most uses, I highly recommend cpp-httplib.

    This recommendation replaces my previous answer (8 years ago).

提交回复
热议问题