Skip to content

Instantly share code, notes, and snippets.

@TobiasBerg
Last active January 22, 2021 12:27
Show Gist options
  • Save TobiasBerg/13bc7235395b7c3cf9168513f038f2f5 to your computer and use it in GitHub Desktop.
Save TobiasBerg/13bc7235395b7c3cf9168513f038f2f5 to your computer and use it in GitHub Desktop.
C Write Player Storage
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.lootlocker.io/game/v1/player/storage");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "x-session-token: your session token");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "[{\"order\": 1,\"key\": \"characterColor\",\"value\": \"0,193,82\"}]";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment