LibCXX 是一个 C++ 类库,提供了高级的应用框架类和一些 Linux 专有的特性封装。
上传文件示例代码:
auto resp=ua->request(x::http::POST, "http://localhost/cgi-bin/req.pl", x::http::form::parameters::create("username", "alfred", "password", "rosebud"), "UTF-8", "file", x::fd::open("upload.txt"), "text/plain; charset=iso-8859-1", "dailyfile.txt");
Cookie 处理代码:
#include <x/http/cookiejar.H> x::http::useragent ua(x::http::useragent::create()); try { ua->jar()->load("cookies.txt"); } catch (const x::exception &e) { } // ... ua->jar()->save("cookies.txt");