xml'den veri çekerken takıldım
<rss>
<canel>
<item>
<id>1</id>
<cat>1</cat>
<city>25</city>
<type>2</type>
<title>title 1</title>
<description>description text</description>
<date>16.08.2020</date>
<images>
<image code="20200815" imagecode="20200815N1_01">bd05-94ddce6ab21r.jpg</image>
</images>
</item>
<item>
<id>2</id>
<cat>5</cat>
<city>3</city>
<type>1</type>
<title>title 2</title>
<description>description text 2</description>
<date>16.08.2020</date>
<images>
<image code="20200815" imagecode="20200815N2_01">bd05-94cde6ab25d.jpg</image>
<image code="20200815" imagecode="20200815N2_02">bd09-94cde6ab28f.jpg</image>
<image code="20200815" imagecode="20200815N2_03">bd02-94cde6ab95u.jpg</image>
<image code="20200815" imagecode="20200815N2_04">bd03-94cde6ab23p.jpg</image>
<image code="20200815" imagecode="20200815N2_05">bd050-94cde6ab2g.jpg</image>
</images>
</item>
</canel>
</rss>
Merhaba arkadaş xml'den simplexml_load_file ile veri çekerken bir yerde takıldım yardımınızı rica ediyorum. Yukarıdaki xml örneğinde olduğu gibi bazı kayıtlarda birden çok resim var. Bu resimleri nasıl çekebilirim ?
echo "<ul>";
$xml = simplexml_load_file('rss.xml');
foreach ($xml->canel as $canel) {
foreach ($canel->item as $item) {
$id = $item->id;
$cat = $item->cat;
$city = $item->city;
$type = $item->type;
$title = $item->title;
$type = $item->description;
$type = $item->date;
foreach ($item->images->image as $image) {
echo "<li>id = $id image = $image</li>";
}
}
}
echo "</ul>";