C语言 用于 C 的 HTTP POST/GET 的轻量级库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2221857/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 04:25:09  来源:igfitidea点击:

Good lightweight library for HTTP POST/GET for C?

chttpsocketswinsock

提问by Markus R.

I'm planning of creating a Last.FM scrobbler plugin for a music player in Windows. Last.FM submissions APIrelays on HTTP/1.1 GET and POST.

我计划为 Windows 中的音乐播放器创建一个 Last.FM scrobbler 插件。Last.FM 提交 API在 HTTP/1.1 GET 和 POST 上中继。

I've never done Internet oriented programming and I've still to know about the HTTP protocol but I'd like to start playing around with it sending and getting some data. I've looked at the Winsock interface but I don't know if it would be better to use any easier thing.

我从来没有做过面向 Internet 的编程,我仍然知道 HTTP 协议,但我想开始玩它发送和获取一些数据。我看过 Winsock 界面,但我不知道使用更简单的东西是否会更好。

Do anyone of you know how could I do it? What could I use?

你们中有人知道我该怎么做吗?我可以用什么?

If so, could you point me to a tutorial too?

如果是这样,你能否也给我指一个教程?

If it's a library it would be good that I can link statically to it, I would want to supply only the DLL of the plugin.

如果它是一个库,我可以静态链接到它会很好,我只想提供插件的 DLL。

采纳答案by ephemient

Windows comes with WinHttp, which does support GET and POST.

Windows 带有WinHttp,它支持 GET 和 POST。

回答by Daniel A. White

LibCurlis one of the most widely used and most portable.

LibCurl是最广泛使用和最便携的之一。

回答by joveha

libghttpis pretty lightweight.

libghttp非常轻量级。

Im unsure if it will compile cleanly on win32 though.

我不确定它是否会在 win32 上干净地编译。

回答by egalano

This is an old thread but in case this helps anyone else:

这是一个旧线程,但以防万一这对其他人有帮助:

Use libCurl http://curl.haxx.se/libcurl/c/simplepost.html

使用 libCurl http://curl.haxx.se/libcurl/c/simplepost.html

This is the easiest way I've found of doing a quick http post or get

这是我发现的快速 http 发布或获取的最简单方法