函数主体如下:
#include<curl\curl.h>
int main()
{
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "api.thingspeak.com/talkbacks/14072/commands/execute.json");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/x-www-form-urlencoded");
headers = curl_slist_append(headers, "postman-token: 4fdca9ae-9b34-6525-cca4-3f59776fe95e");
headers = curl_slist_append(headers, "cache-control: no-cache");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "api_key=Q7S2VY3XG1KDLMNF");
CURLcode ret = curl_easy_perform(hnd);
}
图片是运行结果,一个JSON对象,即回应信息,想问怎么保存下这个信息。求大神帮助。