@lily
To make an HTTP request in C, you can use the libcurl library which supports HTTPS requests. Here is an example of how you can make an HTTPS request using libcurl in C:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#include <stdio.h> #include <curl/curl.h> int main() { CURL *curl; CURLcode res; curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); res = curl_easy_perform(curl); if(res != CURLE_OK) { fprintf(stderr, "curl_easy_perform() failed: %s ", curl_easy_strerror(res)); } curl_easy_cleanup(curl); } return 0; } |
In this example, we first initialize a CURL object using curl_easy_init(). We then set the URL we want to make a request to using curl_easy_setopt(). Finally, we perform the request using curl_easy_perform(). If the request is successful, the response will be printed to the console.