2019-01-19 12:40:10 +00:00
|
|
|
#ifndef NETWORK_HPP
|
|
|
|
#define NETWORK_HPP
|
|
|
|
|
2019-02-04 16:39:48 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
|
2019-06-07 11:12:59 +00:00
|
|
|
#include <WinInet.h>
|
2020-01-15 09:00:25 +00:00
|
|
|
#include <Windows.h>
|
2019-02-04 16:39:48 +00:00
|
|
|
|
|
|
|
using string = std::wstring;
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2019-01-19 12:40:10 +00:00
|
|
|
#include <curl/curl.h>
|
2020-01-15 09:00:25 +00:00
|
|
|
#include <string>
|
2019-01-19 12:40:10 +00:00
|
|
|
|
2019-02-04 16:39:48 +00:00
|
|
|
using string = std::string;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2019-01-19 12:40:10 +00:00
|
|
|
class Curl {
|
|
|
|
public:
|
|
|
|
Curl();
|
|
|
|
~Curl();
|
2020-01-15 09:00:25 +00:00
|
|
|
std::string get( const string &url );
|
|
|
|
std::string post( const std::string &url, const std::string &data );
|
|
|
|
void addHeader( const std::string &header );
|
|
|
|
void clearHeader();
|
2019-02-04 16:39:48 +00:00
|
|
|
|
2019-01-19 12:40:10 +00:00
|
|
|
private:
|
2019-02-04 16:39:48 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
HINTERNET connect = nullptr;
|
|
|
|
#else
|
2019-01-19 12:40:10 +00:00
|
|
|
CURL *curl_handle;
|
2020-01-15 09:00:25 +00:00
|
|
|
struct curl_slist *chunk = NULL;
|
2019-02-04 16:39:48 +00:00
|
|
|
#endif
|
2019-01-19 12:40:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|