articles_code / picloud_article / client1.c

Full commit
/* This part of the client invokes the REST API of
   PiCloud and retrieves the Job ID

#include <stdio.h>
#include <curl/curl.h>

int main(void)
  CURL *curl;

  /* Make sure you set this appropriately*/
  char *url="";
  CURLcode res;
  curl = curl_easy_init();
  if(curl) {
    /* First set the URL that is about to receive our POST. This URL can
       just as well be a https:// URL if that is what should receive the
       data. */
    curl_easy_setopt(curl, CURLOPT_URL, url);
    /* Specify the user/pass */
    /* Now specify the POST data */
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "x=5");
    /* For HTTPS */
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);

    /* Perform the request, res will get the return code */
    res = curl_easy_perform(curl);
    printf("\nResult of Operation:: %d\n", res);

    /* always cleanup */
  return 0;