2012-07-23 17:13:59 +05:30
|
|
|
#ifndef HTTPREQ_H
|
|
|
|
#define HTTPREQ_H
|
|
|
|
|
2012-12-10 13:09:56 +04:00
|
|
|
#include "curl/curl.h"
|
2015-11-18 14:05:57 +01:00
|
|
|
#include "transport/Logging.h"
|
2012-07-23 17:13:59 +05:30
|
|
|
#include <iostream>
|
|
|
|
#include <sstream>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
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
|