Advertisement

libcurl实现HTTP协议中的PUT和GET方法

阅读量:
复制代码
    #include <string>
    #include <iostream>
    #include <curl/curl.h>
    
    
    AI写代码cpp

1.代码实现与功能验证

复制代码
    //使用示例
    /*
    int main(int argc, char *argv[]) {
    CURLcode code;
    std::string r1 = get("http://qtdebug.com/html/data.json");
    qDebug() << QString::fromUtf8(r1.data());
    
    qDebug() << "------------------------------------------------";
    
    std::string r2 = post("http://eplatform.edu-edu.com.cn/live/api/auth/login", "{ \"username\": \"u1\", \"password\": \"abcd\"}", true);
    qDebug() << QString::fromUtf8(r2.data());
    
    qDebug() << "----

全部评论 (0)

还没有任何评论哟~