adding some curl helpers

Origin commit data
------------------
Branch: ni/coolstream
Commit: 25887007ac
Author: TangoCash <eric@loxat.de>
Date: 2018-08-19 (Sun, 19 Aug 2018)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
TangoCash
2018-08-19 21:14:54 +02:00
committed by vanhofen
parent 03ba0db2fd
commit a156eb2c3d
3 changed files with 175 additions and 7 deletions

View File

@@ -33,6 +33,9 @@
#include <sys/types.h>
#include <map>
#include <curl/curl.h>
#include <curl/easy.h>
int my_system(const char * cmd);
int my_system(int argc, const char *arg, ...); /* argc is number of arguments including command */
@@ -160,4 +163,20 @@ std::string readFile(std::string file);
std::string iso_8859_1_to_utf8(std::string &str);
bool utf8_check_is_valid(const std::string &str);
// curl
struct MemoryStruct {
char *memory;
size_t size;
};
size_t CurlWriteToString(void *ptr, size_t size, size_t nmemb, void *data);
size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data);
std::string encodeUrl(std::string txt);
std::string decodeUrl(std::string url);
bool getUrl(std::string &url, std::string &answer, const std::string userAgent = " ", unsigned int timeout = 60);
bool downloadUrl(std::string url, std::string file, const std::string userAgent = " ", unsigned int timeout = 60);
//
#endif