<table>
<?php
// 外部RSSを簡単に読み込んで出力するルーチン
$RSSURL = "ttp://feedblog.ameba.jp/rss/ameblo/staff/rss20.xml";
$buff = "";
$fp = fopen($RSSURL,"r");
while ( !feof($fp) ) {
$buff .= fgets($fp,4096);
}
fclose($fp);
// パーサ作成
$parser = xml_parser_create();
// パーサオプションを指定
xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
// パース実行、連想配列にパース結果代入
xml_parse_into_struct($parser,$buff,$values,$idx);
// パーサ開放
xml_parser_free($parser);
// パースして得た連想配列をまわす
$in_item = 0;
$count = 0;
foreach ($values as $value) {
$tag = $value["tag"];
$type = $value["type"];
$value = $value["value"];
$tag = strtolower($tag);
if ($tag == "item" && $type == "open") {
$in_item = 1;
} else if ($tag == "item" && $type == "close") {
if($count < 10){
echo "<tr><th>".$dateDisp."</th><td><a href=\"".$link."\"> ".$title."</a></td></tr>\n";
}