This is a C++ MINI wrapper for well known C-library "libcurl". Wrapper makes a query and gets a text or the simplest json as a result. No performance but extreme simplicity - basically makes GET, PUT queries and gets back the chars.
See the tests for the details and examples.
To magnificent Vinnie Falco, his contribution to Boost for broader subject.
- C++20
- libcurl
Allows to manage:
- url, ie insert something in the middle - in case it deals with some kind of REST API
- request headers
- request methods
#include "curl_client.h"
...
std::string const test_url {"https://httpbin.org/get"};
curl_client::request request;
curl_client::response response = request.
setURL(test_url)->
implement(curl_client::Method::Get);
curl_client::Print(response, std::cout);
...
For more examples see the ./test folder
Done using this special purpose and very nice website. Indeed, there is no guarantee it stays online forever.
- Copy-paste ./curl_client into your source dir.
add_subdirectory(curl_client)
is expected - Then link curl_client lib into your project, see ./tests/CMakeLists.txt as an example:
target_link_libraries(${TESTS_NAME}
${GTEST_LIBRARIES}
curl_client
)
MIT