昨日の記事で、[Google API を利用して外部サイトのRSS情報を取得して表示させる方法]を紹介しましたが、今回は同じ処理を PHP を用いて実装します。 以下、プログラムのコードはなるべくシンプルになるように徹しました。 <?php $rss = simplexml_load_file('https://on-ze.com/feed'); echo '<ul>'; foreach($rss->channel->item as $item){ $title = $item->title; $date = date("Y年 n月 j日", strtotime($item->pubDate)); $link = $item->link; $description = mb_strimwidth (strip_tags($item->description), 0 , 110, "…Rea
![【PHP】外部サイトのRSS情報を取得して表示させる方法。](https://cdn-ak-scissors.b.st-hatena.com/image/square/619ea591ff08f5018e9705d3d2b2772600509cc6/height=288;version=1;width=512/https%3A%2F%2Fon-ze.com%2Fwordpress%2Fwp-content%2Fthemes%2Fonze-2022%2Finc%2Fthumbnail%2F600x360x80-9ba6cca3e6aff99506726b2a7bd0d9af-thumbnail.png)