diff --git a/backends/twitter/HTTPRequest.h b/backends/twitter/HTTPRequest.h new file mode 100644 index 0000000000000000000000000000000000000000..d6b35ea39130aaa01a101f1fa04d3ffee68f2199 --- /dev/null +++ b/backends/twitter/HTTPRequest.h @@ -0,0 +1,37 @@ +#ifndef HTTPREQ_H +#define HTTPREQ_H + +#include "libtwitcurl/curl/curl.h" +#include "transport/logging.h" +#include +#include +#include + +class HTTPRequest +{ + CURL *curlhandle; + char curl_errorbuffer[1024]; + std::string error; + std::string callbackdata; + + static int curlCallBack(char* data, size_t size, size_t nmemb, HTTPRequest *obj); + + public: + HTTPRequest() { + curlhandle = NULL; + } + + ~HTTPRequest() { + if(curlhandle) { + curl_easy_cleanup(curlhandle); + curlhandle = NULL; + } + } + + bool init(); + void setProxy(std::string, std::string, std::string, std::string); + bool GET(std::string, std::string &); + std::string getCurlError() {return std::string(curl_errorbuffer);} +}; + +#endif