12 ((
std::string*)ptr)->append((
char*)contents, size * nmemb);
20 char errbuf[CURL_ERROR_SIZE];
22 curl = curl_easy_init();
23 unsigned long ret =
false;
25 struct curl_slist* chunk =
nullptr;
26 chunk = curl_slist_append(chunk,
"content-type:application/json");
27 curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
28 curl_easy_setopt(curl, CURLOPT_URL, urlString.c_str());
30 curl_easy_setopt(curl, CURLOPT_WRITEDATA, &body);
31 curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf);
32 res = curl_easy_perform(curl);
33 curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &ret);
34 if (CURLE_OK == res) {
37 size_t len = strlen(errbuf);
38 fprintf(stderr,
"\nlibcurl: (%d) ", res);
40 fprintf(stderr,
"%s%s", errbuf, ((errbuf[len - 1] !=
'\n') ?
"\n" :
""));
42 fprintf(stderr,
"%s\n", curl_easy_strerror(res));
44 curl_easy_cleanup(curl);
tuple ret
prodAgent to be discontinued
static size_t getBodyCallback(void *contents, size_t size, size_t nmemb, void *ptr)
tuple body
create merge config
unsigned long httpGet(const std::string &urlString, std::string &info)
tuple size
Write out results.