I'm looking for a C++ library that implements or enables the implementation of a HTTP client. It should handle cookies as well.
What would you propose?
The HTTP Client library provides a basic API through which HTTP requests can be created and executed from within your model.
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.
Curl++: is an option, particularly if you want things in more of a C++ style.
cpp-netlib: very good and simple to use, available on ubuntu
sudo apt-get install libcppnetlib-dev
example:
using namespace boost::network; using namespace boost::network::http; client::request request_("http://127.0.0.1:8000/"); request_ << header("Connection", "close"); client client_; client::response response_ = client_.get(request_); std::string body_ = body(response_);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With