Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

http

client

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?

like image 230
Piotr Dobrogost Avatar asked May 04 '09 23:05

Piotr Dobrogost


People also ask

What is HTTP Client library?

The HTTP Client library provides a basic API through which HTTP requests can be created and executed from within your model.

How do I make a Web request in C++?

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.


1 Answers

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_); 
like image 158
bdonlan Avatar answered Sep 26 '22 00:09

bdonlan