Skip to content
Snippets Groups Projects
Commit 653950c4 authored by Jakob Olsson's avatar Jakob Olsson
Browse files

works now, need add your json parsing etc, perform in two setps

parent 7603d0be
Branches
No related tags found
No related merge requests found
......@@ -50,7 +50,7 @@ static char *request(const char *url)
char *data = NULL;
long code;
curl_global_init(CURL_GLOBAL_ALL);
//curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
printf("init curl session\n");
if(!curl)
......@@ -67,12 +67,18 @@ static char *request(const char *url)
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, ""); //Read locally stored cookies
curl_easy_setopt(curl, CURLOPT_COOKIEJAR, "cookies.txt"); //Save the cookie from the server to cookie.txt
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "cookies.txt"); //Read locally stored cookies
sleep(1);
curl_easy_setopt(curl, CURLOPT_URL, "http://192.168.8.1/api/monitoring/status");
//curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_response);
//curl_easy_setopt(curl, CURLOPT_WRITEDATA, &write_result);
status = curl_easy_perform(curl);
curl_easy_setopt(curl, CURLOPT_URL, "http://192.168.8.1/api/device/information");
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "cookies.txt"); //Read locally stored cookies
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_response);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &write_result);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment