sebbu

libcurl example

Oct 2nd, 2026
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | Source Code | 0 0
  1. #include <stdbool.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5.  
  6. #include <curl/curl.h>
  7.  
  8. int main(void) {
  9.     curl_global_init(CURL_GLOBAL_WIN32|CURL_GLOBAL_SSL);
  10.    
  11.     CURL* handle = curl_easy_init();
  12.     curl_easy_setopt(handle, CURLOPT_VERBOSE, true);
  13.     curl_easy_setopt(handle, CURLOPT_URL, "https://ifconfig.me/ip");
  14.     curl_easy_perform(handle);
  15.     putchar('\n');
  16.    
  17.     curl_global_cleanup();
  18.     return EXIT_SUCCESS;
  19. }
  20.  
  21.  
Advertisement
Add Comment
Please, Sign In to add comment