// Author: tastytea // CC-0 / Public Domain #include #include #include #include #include #include #include #include namespace curlopts = curlpp::options; using std::string; using std::cout; using std::cerr; using std::endl; int main() { const string version = "2019-02-11_1"; try { string year = "2019"; string today = "2019-12-25"; string tomorrow = "2019-12-26"; curlpp::Easy request; std::stringstream ss; request.setOpt("https://feiertage-api.de/api/?jahr=" + year); request.setOpt("feiertagebot/" + version); request.setOpt(true); ss << request; Json::Value root; ss >> root; for (Json::Value::const_iterator it_root = root.begin(); it_root != root.end(); ++it_root) { for (Json::Value::const_iterator it_region = it_root->begin(); it_region != it_root->end(); ++it_region) { if ((*it_region)["datum"] == today) { cout << it_root.key() << ": " << (*it_region)["datum"] << ": " << it_region.key() << endl; } } } } catch (const std::exception &e) { cerr << e.what() << endl; return 1; } return 0; }