LoginSignup
4
4

More than 5 years have passed since last update.

/composer.jsonに以下を追加

composer.json
"require": {
    ・・・
    "simplepie/simplepie": "1.3.1"
},

 

comporserアップデート
php composer.phar update
 
 
使用方法は以下のように

Controller
$feed = new SimplePie();
$feed->enable_cache(false);
$feed->set_feed_url('http://hoge.com');
$feed->init();

$data = [];
foreach ($feed->get_items() as $tmp) {
    $data[] = array(
        'title' => $tmp->get_title(),
        'url' => $tmp->get_link(),
        'site' => $tmp->get_feed()->get_title(),
        'created' => $tmp->get_date('Y-m-d'),
    );
}
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4