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://www.codercto.com/soft/d/413.html

Twitter Power

Twitter Power

Joel Comm / Wiley / 2009-02-17 / USD 24.95

"Arguably, one of the best tomes...Twitter Power is jam-packed with clever ways to start and dominate a marketplace." (Brandopia.typepad.com, March 23rd 2009) &#8220;For months I......一起来看看 《Twitter Power》 这本书的介绍吧!

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

在线压缩/解压 JS 代码

随机密码生成器
随机密码生成器

多种字符组合密码