본문 바로가기
Linux

[Linux] C 에서 curl library 사용하기

by 원동호 2020. 2. 4.
반응형
#include <curl/curl.h>

CURL *curl;
CURLcode res;
char url[]= "요청할 URL 입력";

//POST로 요청할 경우
char postData[] = "colorname=newuser&datetime=newpasswd";

 
curl = curl_easy_init();
    if(curl) {
        curl_easy_setopt(curl, CURLOPT_URL, url);
        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postData);
        res = curl_easy_perform(curl);
        curl_easy_cleanup(curl);
        return 0;
    }
    
return 0;

 

https://stackoverflow.com/questions/11973994/json-requests-in-c-using-libcurl

 

반응형

댓글