开发者

Can I use glib to make some portable http GET request and how?

开发者 https://www.devze.com 2023-01-07 18:30 出处:网络
Was just wondering 开发者_运维知识库if any of you already coded a http get request using glib?

Was just wondering 开发者_运维知识库if any of you already coded a http get request using glib? Is it possible and how ?

I just want to call an simple urls with parameters, and the code must be working on gnu/linux, windows and mac.

If it is not possible with glib, have you any suggestion about what to use for that purpose (in a portable perspective). I want to avoid if possible 3rd party libs to minimize my project dependencies. So in that case of glib is not the right way, any code fragment will be welcome !

Thanks Sinn'


Yes, you can use libsoup. It's part of GNOME, and designed for use with GLib. You can start with the howto. E.g. it shows how to create a basic GET request:

SoupMessage *msg;
msg = soup_message_new ("GET", "http://example.com/");
SoupSession *session = soup_session_sync_new();
guint status = soup_session_send_message (session, msg);
0

精彩评论

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

关注公众号