Auslesen einer RSS-Datei

Methode: get_data()

Genau 3 Meldungen (nur Titel und Beschreibung) sollen angezeigt werden.


<?php
require_once("../xml-line.php");
$mylines = new xml_line("xml-files/rss.xml");
$mylines->get_data(3,"rss/channel/item/title");
$mylines->get_data(3,"rss/channel/item/description");
$result=$mylines->xml_stream();
echo "<pre>";
print_r ($result);
echo "</pre>";
for ($i = 0; $i < 3; $i++) {
    printf( "<h3>%s</h3>" , $result[0][$i][0]);
    printf( "<p>%s</p>" , $result[1][$i][0]);
}
?>

Array
(
    [0] => Array
        (
            [0] => Array
                (
                    [0] => Titel 1
                    [1] => title
                    [2] => Array
                        (
                        )

                    [3] => rss/channel/item/title
                    [4] => 1-1-1-1
                )

            [1] => Array
                (
                    [0] => Titel 2
                    [1] => title
                    [2] => Array
                        (
                        )

                    [3] => rss/channel/item/title
                    [4] => 1-1-2-1
                )

            [2] => Array
                (
                    [0] => Titel 3
                    [1] => title
                    [2] => Array
                        (
                        )

                    [3] => rss/channel/item/title
                    [4] => 1-1-3-1
                )

        )

    [1] => Array
        (
            [0] => Array
                (
                    [0] => Hier die Description zu Meldung 1
                    [1] => description
                    [2] => Array
                        (
                        )

                    [3] => rss/channel/item/description
                    [4] => 1-1-1-1
                )

            [1] => Array
                (
                    [0] => Hier die Description zu Meldung 2
                    [1] => description
                    [2] => Array
                        (
                        )

                    [3] => rss/channel/item/description
                    [4] => 1-1-2-1
                )

            [2] => Array
                (
                    [0] => Hier die Description zu Meldung 3
                    [1] => description
                    [2] => Array
                        (
                        )

                    [3] => rss/channel/item/description
                    [4] => 1-1-3-1
                )

        )

)

Titel 1

Hier die Description zu Meldung 1

Titel 2

Hier die Description zu Meldung 2

Titel 3

Hier die Description zu Meldung 3