title: Simple interface for getting HTML content in Boost.Asio
body: <p>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.</p>
  
  <p>For instance, if I need to get content of <em><a href="http://www.foo.bar/path/to/default.html" rel="nofollow noreferrer">http://www.foo.bar/path/to/default.html</a></em>, is there any way to get a content without validating URL, making HTTP request and parsing server answer?</p>
  
  <p>Basically, I am looking for something like this:</p>
  
  <pre><code>std::string str = boost::asio::get_content("http://www.foo.bar/path/to/default.html");
  std::cout &lt;&lt; str;
  
  #
  &lt;HTML&gt;
    &lt;BODY&gt;
      Simple HTML page!
    &lt;/BODY&gt;
  &lt;/HTML&gt;
  </code></pre>
  
  <p>There are couple of things that I would like to avoid using boost.asio.</p>
  
  <ul>
  <li>Avoid parsing and validating URL.</li>
  <li>Manually creating HTTP request.</li>
  <li>Cutting HTTP response from HTML page content.</li>
  </ul>