Overview

A simple Get request in C++

We have used a C++ Requests package.

Note- Use https:// in the url.

#include <cpr/cpr.h>

int main(int argc, char** argv) {
    auto r = cpr::Get(cpr::Url{"https://unfurl.io/api/v2/preview?api_token=yourapitoken&url=https://www.google.com"});
    r.status_code;                  // 200
    r.header["content-type"];       // application/json; charset=utf-8
    r.text;                         // JSON text string
}