What C++ library should I use to implement a HTTP client?


Question

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?

1
38
2/17/2013 11:44:32 PM

Accepted Answer

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_);
28
1/30/2018 12:52:15 PM

Take a look at Poco Libraries.

I started using them as they are portable and it's a joy to work with. Simple and clean - though I haven't dived in anything fancy for the moment.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon