开发者

HTTP Get request in C

I'm just learning to code in C, and I wan't to know if anyone can point me in the right direction, or give me an example for a simple HTT开发者_如何学编程P Get request in C.

Thanks :)


You may checkout libcurl. And here are some examples. It could be as easy as (taken from the doc):

#include <stdio.h>
#include <curl/curl.h>

int main(void)
{
    CURL *curl;
    CURLcode res;

    curl = curl_easy_init();
    if(curl) {
        curl_easy_setopt(curl, CURLOPT_URL, "curl.haxx.se");
        res = curl_easy_perform(curl);
        /* always cleanup */ 
        curl_easy_cleanup(curl);
    }
    return 0;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜