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

后端 未结 22 2757
有刺的猬
有刺的猬 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条回答
  •  一整个雨季
    2020-11-22 07:09

    C++ does not provide any way to do it directly. It would entirely depend on what platforms and libraries that you have.

    At worst case, you can use the boost::asio library to establish a TCP connection, send the HTTP headers (RFC 2616), and parse the responses directly. Looking at your application needs, this is simple enough to do.

提交回复
热议问题