460d136d21
Spun out of the hbm-books working folder into its own repo. A small backend+frontend+COBOL admin tool for managing Foundry VTT worlds (socket inspection, join/shutdown debugging).
29 lines
800 B
C
29 lines
800 B
C
#include <stdio.h>
|
|
#include <curl/curl.h>
|
|
|
|
int send_actor_update(const char* url, const char* json_data) {
|
|
CURL *curl;
|
|
CURLcode res;
|
|
int success = 1;
|
|
|
|
curl = curl_easy_init();
|
|
if(curl) {
|
|
struct curl_slist *headers = NULL;
|
|
headers = curl_slist_append(headers, "Content-Type: application/json");
|
|
|
|
curl_easy_setopt(curl, CURLOPT_URL, url);
|
|
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
|
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_data);
|
|
|
|
res = curl_easy_perform(curl);
|
|
if(res != CURLE_OK) {
|
|
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
|
|
success = 0;
|
|
}
|
|
|
|
curl_slist_free_all(headers);
|
|
curl_easy_cleanup(curl);
|
|
}
|
|
return success;
|
|
}
|