// // Created by Marek Kotewicz on 15/06/15. // // based on http://stackoverflow.com/questions/1011339/how-do-you-make-a-http-request-with-c/27026683#27026683 #include #include #include #include class CURLRequest { public: CURLRequest(): m_curl(curl_easy_init()) {}; ~CURLRequest() { if (m_curl) curl_easy_cleanup(m_curl); } void setUrl(std::string _url) { m_url = _url; } void setBody(std::string _body) { m_body = _body; } std::tuple post(); private: std::string m_url; std::string m_body; CURL* m_curl; std::stringstream m_resultBuffer; void commonCURLPreparation(); std::tuple commonCURLPerform(); };