• 0

Get (Namespaced?) value from RSS?


Question

How can i get the following data from a RSS feed with PHP media:link

<media:link>http://www.some-url.com/</media:link>[/CODE]

I'm using SimpleXML and can easily grab things like <title>Some title</title>

Current code

[CODE]
foreach($RSS_DOC->channel->item as $item) {
$title = $item->title;
}
[/CODE]

But not sure how to do it for items with a colon. it gives a fatal error.

Link to comment
https://www.neowin.net/forum/topic/1128796-get-namespaced-value-from-rss/
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Nevermind work it out, this always happens, i'll look for hours, give up and make a thread, work it out 5 minutes later..


$namespace = $item->getNameSpaces(true);
$media = $item->children($namespace['media']);
$link = $media->link;
[/CODE]

This topic is now closed to further replies.
  • Posts

  • Recent Achievements

    • One Year In
      Console General earned a badge
      One Year In
    • One Year In
      Twozo Technologies earned a badge
      One Year In
    • One Month Later
      Twozo Technologies earned a badge
      One Month Later
    • Week One Done
      Twozo Technologies earned a badge
      Week One Done
    • Veteran
      branfont went up a rank
      Veteran
  • Popular Contributors

    1. 1
      +primortal
      509
    2. 2
      +Edouard
      197
    3. 3
      PsYcHoKiLLa
      131
    4. 4
      Steven P.
      88
    5. 5
      neufuse
      74
  • Tell a friend

    Love Neowin? Tell a friend!