clear code
headerlist = curl_slist_append(headerlist, "User-Agent: curl/7.39.0");
char autorize [200] = "Authorization:Basic ";
strcat(autorize, keyv);
headerlist = curl_slist_append(headerlist, autorize);
headerlist = curl_slist_append(headerlist, "Content-Type:application/x-www-form-urlencoded;charset=UTF-8");
headerlist = curl_slist_append(headerlist, "Content-Length:29");
headerlist = curl_slist_append(headerlist, "Accept-Encoding:gzip");
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "https://api.twitter.com/oauth2/token");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "grant_type=client_credentials");
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
Work )