forked from shashankkumar/CodeRunner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCurlWrapper.h
executable file
·41 lines (34 loc) · 1.04 KB
/
CurlWrapper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef CURLWRAPPER
#define CURLWRAPPER
#include "includeh.h"
#include "FileInfo.h"
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>
#include "config.h"
class CurlWrapper{
CURL *curl;
CURLcode res;
char logs[1000];
struct FtpFile {
const char *filename;
FILE *stream;
};
public:
CurlWrapper(){
curl_global_init(CURL_GLOBAL_DEFAULT);
Logs::OpenLogFile();
}
~CurlWrapper(){
curl_global_cleanup();
}
static size_t ContentInFileFTP(void *buffer, size_t size, size_t nmemb, void *stream);
static size_t ContentInVar(void* ptr, size_t size, size_t nmemb, string *stream);
static size_t ContentInFileHTTP(void *ptr, size_t size, size_t nmemb, FILE *stream);
static bool ForcePushResult;
int GetFileFromFTP(int FileId);
int GetFileFromHTTP(int FileId);
int FetchContentFromWebPage(FileInfoFetchOptionsStruct* FileInfoFetchOptions, string *content);
void SendResultsToWebpage(const char* fileid, const char* status, const char* detailstatus, const char* time, const char* memory);
};
#endif