C 语言的 HTTP 库 libghttp

码农软件 · 软件分类 · 网络工具包 · 2019-03-01 19:13:01

软件介绍

libghttp 是一个很好用的 http 库,这个库十分的方便使用,它能够轻松地实现同步和异步的 Http 请求。

示例代码:

#include <ghttp.h>
int main(int argc, char *argv[])
{
    char *uri = "http://www.oschina.net/";
    ghttp_request *request = NULL;
    ghttp_status status;
    char *buf;
    int bytes_read;
    
    request = ghttp_request_new();
    if(ghttp_set_uri(request, uri) == -1)
        exit(-1);
    if(ghttp_set_type(request, ghttp_type_get) == -1)
        exit(-1);
    ghttp_prepare(request);
    status = ghttp_process(request);
    if(status == ghttp_error)
        exit(-1);
    /* OK, done */
    printf("Status code -> %d\n", ghttp_status_code(request));
    buf = ghttp_get_body(loader->request);
    bytes_read = ghttp_get_body_len(loader->request);
    return 0;
}

本文地址:https://codercto.com/soft/d/413.html

Spring in Action

Spring in Action

Craig Walls / Manning Publications / 2011-6-29 / USD 49.99

Spring in Action, Third Edition has been completely revised to reflect the latest features, tools, practices Spring offers to java developers. It begins by introducing the core concepts of Spring and......一起来看看 《Spring in Action》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

在线进制转换器
在线进制转换器

各进制数互转换器

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具