void* kds_s2000w_handler_get_option(int option)
{
+ CURL *curl = curl_easy_init();
+ if(!curl)
+ return NULL;
+
+ response resp = {0};
+ CURLU* url_handler = curl_url();
+ curl_url_set(url_handler, CURLUPART_URL, "http://scanner.lan.hhaalo.de/api/session", 0);
+ char query[75];
+ sprintf(query, "SessionId=%li", sessionid);
+ curl_url_set(url_handler, CURLUPART_QUERY, query, CURLU_APPENDQUERY | CURLU_URLENCODE);
+ char* url = NULL;
+ curl_url_get(url_handler, CURLUPART_URL, &url, 0);
+ printf(url);
+
+ curl_easy_setopt(curl, CURLOPT_URL, url);
+ curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
+ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
+ curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*) &resp);
+ CURLcode result = curl_easy_perform(curl);
+ curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &resp.code);
+
+ printf("%s", resp.data);
+
+ curl_url_cleanup(url_handler);
+ url_handler = NULL;
+ curl_free(url);
+ url = NULL;
+ free(resp.data);
return NULL;
}
curl_url_set(url_handler, CURLUPART_URL, "http://scanner.lan.hhaalo.de/api/session", 0);
char* url = NULL;
curl_url_get(url_handler, CURLUPART_URL, &url, 0);
+
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_POST, 1L);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"OCPUserName\":\"hhaalo\"}");