A super easy c++11 curl wrapper.
It only wraps the bits that I need; I'm not planning to any more development on it unless I need it, but all contributions and requests are welcome.
Just download the two files into your project:
- https://raw.githubusercontent.com/matiu2/curlpp11/master/src/curl.hpp
- https://raw.githubusercontent.com/matiu2/curlpp11/master/src/curl.cpp
- Always use the global sentry in your main function (see below)
- One curl::Easy per thread
#include "curl.hpp"
int main(int argc, char** argv) {
curl::GlobalSentry curl;
...
}
curl::Easy c;
std::string london;
std::string beirut;
c.url("http://api.openweathermap.org/data/2.5/find?q=London")
.perform(london)
.url("http://api.openweathermap.org/data/2.5/find?q=Beirut")
.perform(beirut);
curl::Easy c;
c.url("http://httpbin.org/delete")
.DELETE()
.perform();
c.perform();
if (c.responseCode() != 200)
blowUpTheWorld();