There are a lot of examples how to make HTTP request to a server and get reply via boost.asio library. However, I couldn't find a good example of simple interface and wondering, if I need to implement it myself.
For instance, if I need to get content of http://www.foo.bar/path/to/default.html, is there any way to get a content without validating URL, making HTTP request and parsing server answer?
Basically, I am looking for something like this:
std::string str = boost::asio::get_content("http://www.foo.bar/path/to/default.html");
std::cout << str;
#
<HTML>
<BODY>
Simple HTML page!
</BODY>
</HTML>
There are couple of things that I would like to avoid using boost.asio.
- Avoid parsing and validating URL.
- Manually creating HTTP request.
- Cutting HTTP response from HTML page content.