很简单的使用libcurl来操作http与服务器来通讯,包含http与https,对外只开放
#include "request.h"
#include "response.h"
#include "url.h"
三个头文件,简单易用,使用的实例如下:
void test_get()
{
Request request("http://httpbin.org/ip");
Response response = request.Perform();
printf("---------------------------------------------\n");
printf("%s\n", to_string(response.status()));
printf("---------------------------------------------\n");
if (response.status() == Status::SUCCESS
&& response.http_status_code() == http::StatusCode::HTTP_200_OK) // equal to response.ok()
{
// Header
printf("------ Headers -------------------------------\n");
auto& headers = response.headers();
for (auto& header : headers)