Sign in to follow this  
Followers 0

php Get (Namespaced?) value from RSS?

2 posts in this topic

Posted

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.

Share this post


Link to post
Share on other sites

Posted

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;

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.