June 2018
Intermediate to advanced
348 pages
8h 45m
English
We have already come across the CURL utility, which is, in fact a wrapper on top of the libcurl library. We will use the libcurl library to access REST services we wrote,in this chapter. To get you familiar with the libcurl library and its programming model, we will write a basic HTTP client using the library: The program will ping the http://example.com.
/////////////////////////////////// // A Simple Program to demonstrate // the usage of libcurl library // #include <stdio.h> #include <curl/curl.h> /////////////////////// // Entrypoint for the program // int main(void) { CURL *curl; CURLcode res; /////////////////////////// // Initialize the library // curl = curl_easy_init(); if(curl) { //----------- ...Read now
Unlock full access