/
BirdLeon
/
ROBLOX2016
Обзор
Документация
Войти
/
BirdLeon
/
ROBLOX2016
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
Library/cpp-netlib/libs/network/example/rss/main.cpp
36 строк
1 KB
PatoFlamejanteTV
full source code
19 дек 2024, 19:11
19 дек 2024, 19:11
05db15d
Код
Авторство
О чём код?
// Copyright (c) Glyn Matthews 2011. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include "rss.hpp" #include <boost/network/protocol/http/client.hpp> #include <iostream> int main(int argc, char *argv[]) { using namespace boost::network; if (argc != 2) { std::cout << "Usage: " << argv[0] << " <url>" << std::endl; return 1; } try { http::client client; http::client::request request(argv[1]); request << header("Connection", "close"); http::client::response response = client.get(request); rss::channel channel(response); std::cout << "Channel: " << channel.title() << " (" << channel.description() << ")" << std::endl; for (const rss::item & item : channel) { std::cout << item.title() << " (" << item.author() << ")" << std::endl; } } catch (std::exception &e) { std::cerr << e.what() << std::endl; } return 0; }