반응형
[Install]
./configure --prefix=설치경로
make
make install
[Example]
CURL *curl;
CURLcode res;
struct
curl_slist *chunk = NULL;
curl = curl_easy_init();
if
(curl) {
char
* params =
"type=a&message=m"
;
chunk = curl_slist_append(chunk,
"Content-Type: application/x-www-form-urlencoded"
);
/* 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. */
res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
// 헤더 등록
/* Now specify the POST data */
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, params);
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (
long
)
strlen
(params));
// 내용 등록
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
// 실제 호출
/* always cleanup */
curl_easy_cleanup(curl);
}
반응형