cfmgrv4/app/Controllers/Utils/RSSFeedController.php
2025-03-12 12:51:37 +09:00

27 lines
663 B
PHP

<?php
namespace App\Controllers\Utils;
use App\Controllers\BaseController;
class RSSFeedController extends BaseController
{
public function getITWorld()
{
$url = 'https://www.itworld.co.kr/rss/feed/index.php';
$rss = simplexml_load_file($url);
$items = [];
foreach ($rss->channel->item as $item) {
$items[] = [
'title' => (string) $item->title,
'link' => (string) $item->link,
'description' => (string) $item->description,
'pubDate' => (string) $item->pubDate
];
}
return $this->response->setJSON($items);
}
}