Jump to content



Photo

Get (Namespaced?) value from RSS?

php

  • Please log in to reply
1 reply to this topic

#1 Uplift

Uplift

    Just below average Joe

  • Tech Issues Solved: 1
  • Joined: 07-May 04
  • Location: England

Posted 02 January 2013 - 17:25

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

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

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

Current code

foreach($RSS_DOC->channel->item as $item) {
$title = $item->title;
}

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


#2 OP Uplift

Uplift

    Just below average Joe

  • Tech Issues Solved: 1
  • Joined: 07-May 04
  • Location: England

Posted 02 January 2013 - 17:39

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;




Click here to login or here to register to remove this ad, it's free!