1

この RSS フィードからカテゴリ ラベルを取得したいのですが、うまくいきません。他のすべては問題なく動作します。

RSS フィード コード:

<im:name>Quizduell</im:name>
<link rel="alternate" type="text/html" href="https://itunes.apple.com/de/app/quizduell/id643791032?mt=8&uo=2"/>
<im:contentType term="Application" label="Programm"/>
<category im:id="6014" term="Games" scheme="https://itunes.apple.com/de/genre/ios-spiele/id6014?mt=8&uo=2" label="Spiele"/>
<im:artist href="https://itunes.apple.com/de/artist/feo-media/id534160178?mt=8&uo=2">FEO Media</im:artist>
<im:price amount="0.00000" currency="EUR">Gratis</im:price>

私のPHPウィジェットコード:

    $count = 0;
    foreach ($doc->getElementsByTagName('entry') as $node) {
        $count = $count + 1;
        $title = htmlspecialchars($node->getElementsByTagName('name')->item(0)->nodeValue); 
        $id = ExtractID(utf8_encode($node->getElementsByTagName('id')->item(0)->nodeValue));
        $price  = htmlspecialchars($node->getElementsByTagName('price')->item(0)->nodeValue);
        $sellerName = htmlspecialchars(($node->getElementsByTagName('artist')->item(0)->nodeValue));
        $image = utf8_encode($node->getElementsByTagName('image')->item(0)->nodeValue);
        $afflink = WP_PLUGIN_URL."/".PLUGIN_BASE_DIRECTORY."/AppStore.php?appid=".$id;

        $appList .= '<li class="store">
                <a class="noeffect" href="'.$afflink.'" rel="nofollow" target="_blank">
                <span class="rank">'.$count.'.</span>
                <img class="image" src=\''.$image.'\'></img>
                <span class="comment">'.$sellerName.'</span>
                <span class="name">'.$title.'</span>
                <span class="comment">'.$price.' '.$label.'</span>                  
                </a>
            </li>';
        if ($count==$topCount){
            break;
            }

getAttribute('label') を追加しようとしましたが、うまく動作しません。foreach ループに 1 行だけ追加したいと思います。解決策は非常に簡単だと思いますが、何時間もウェブを試して検索した後では解決できません:(

4

1 に答える 1