0

I am creating a PHP script that gets many RSS and displays them on the page sorted by date. My problem is that I need to show the name of the blog and the link to it but they are in a higher level in the structure (as below) of where I get the post's title, link, content, images etc.

My question is how can I easily add the blog's title and link without using a strpos maybe in the link of the post to get the info ?

the rss structure

<rss><chanell><title><link><other info for the blog><item>here goes the elements of the post</item><item>and so on</item>

and the main piece of the code

foreach ($feeds as $feed) {
$xml = simplexml_load_file($feed);
$entries = array_merge($entries, $xml->xpath('/rss/channel//item'));
}
.
.
.
foreach ($entries as $entry) {
echo "the title of the blog and the link"
echo $entry->title; //this is the title of the item
}
EnexoOnoma
  • 8,454
  • 18
  • 94
  • 179

1 Answers1

0

Access an element's parent with PHP's SimpleXML?

Community
  • 1
  • 1
Itay Moav -Malimovka
  • 52,579
  • 61
  • 190
  • 278