-
微信文章精选
[C++]- https://www.6api.net/api/weixinarticle/
- 阅读数:5428 上传时间:2020-11-21
- 示例代码
本代码示例是基于C 的六派数据接口进行数据请求 API服务请求的代码示例,使用前你需要:
①:通过https://www.6api.net/api/weixinarticle/ 申请API服务
以下是完整代码示例:
//post请求 #include <iostream> //引入第三方库libcurl(需要配置相应环境) #include <curl/curl.h> int main(int argc, const char * argv[]) { CURL *curl; CURLcode res; curl_global_init(CURL_GLOBAL_DEFAULT); curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "http://open.liupai.net/weixinarticle/channel"); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "appkey=yourappsecret"); res = curl_easy_perform(curl); std::cout << res << std::endl; curl_easy_cleanup(curl); } //清空环境 curl_global_cleanup(); return 0; }