I have been worried that C ++ does not have an easy-to-use http library, but curl is a common concern. I have tried it before and blocked the design. Each thread can only have one handle .. In short, I think it is not easy to use.
Today, I happened to find a Microsoft Open-Source Project, Casablanca. It feels great to try it out. It uses the currently cutting-edge C ++ 11 standard and writes the code as a word: Cool!
To use such an avant-garde library, VS is recommended to be above 2012. It seems that version 2010 was useless before.
Check whether you have installed the NuGet package manager. If not, install it first.
Then go to the installation package Management Console
Enter the installation command "install-package cpprestsdk"
After a moment, the latest rest sdk is installed. The installation directory is "C: \ Program Files (x86) \ Microsoft SDKs \ Cpp rest sdk for Visual Studio 2013"
Create a project and introduce the header file and lib file.
# Include "stdafx. h "# include <iostream> # include
Execution result
Ps: C ++ 11 auto is really a good thing !? No longer afraid of the smelly and long names!