Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7436003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:10:11+00:00 2026-05-29T10:10:11+00:00

I have the following code to parse an RSS feed: $doc = new DOMDocument();

  • 0

I have the following code to parse an RSS feed:

$doc = new DOMDocument();                                                                                                                                                                                                                                                   
$doc->load('http://gdata.youtube.com/feeds/api/users/user/uploads?orderby=viewCount');
$arrFeeds = array();
foreach ($doc->getElementsByTagName('entry') as $node) {
  $itemRSS = array ( 
    'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
    'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
    'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
    'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue
  );
  array_push($arrFeeds, $itemRSS);
}

The feed is something like this:

<title type='text'>Handelswetenschappen</title>
<link rel='alternate' type='text/html' href='http://www.youtube.com/watch?v=eDiF7jVsoAQ&amp;feature=youtube_gdata'/>
<media:group>
  <media:category label='Onderwijs' scheme='http://gdata.youtube.com/schemas/2007/categories.cat'>Education</media:category>
  <media:content url='http://www.youtube.com/v/eDiF7jVsoAQ?version=3&amp;f=user_uploads&amp;app=youtube_gdata' type='application/x-shockwave-flash' medium='video' isDefault='true' expression='full' duration='253' yt:format='5'/>
  <media:content url='rtsp://v3.cache4.c.youtube.com/CigLENy73wIaHwkEoGw17oU4eBMYDSANFEgGUgx1c2VyX3VwbG9hZHMM/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='253' yt:format='1'/>
  <media:content url='rtsp://v6.cache8.c.youtube.com/CigLENy73wIaHwkEoGw17oU4eBMYESARFEgGUgx1c2VyX3VwbG9hZHMM/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='253' yt:format='6'/>
  <media:description type='plain'>Wil jij meer weten over de opleiding Handelswetenschappen? Bekijk dan snel dit filmpje. Studenten Lise en Jean-Marie vertellen je alles over Handelswetenschappen studeren. Ze gaan langs bij de decaan, bij een oud-student en bij toekomstig werkgever.</media:description>
  <media:keywords>HUB, hubrussel, hogeschool, universiteit, brussel, unief, studie, student, studeren, studentenleven, kot, examen, les, cursus, prof, docent, diploma, bachelor, master, professioneel, academisch, opleiding, blokken, eindwerk, eindproef, masterproef, stage, studentenclub, cantus, studiebegeleiding, geslaagd, spieken, fuif, uitgaan, job, studentenjob, handelswetenschappen, economie, TW, toegepaste, economische, wetenschappen, ehsal</media:keywords>
  <media:player url='http://www.youtube.com/watch?v=eDiF7jVsoAQ&amp;feature=youtube_gdata_player'/>
  <media:thumbnail url='http://i.ytimg.com/vi/eDiF7jVsoAQ/0.jpg' height='360' width='480' time='00:02:06.500'/>
  <media:thumbnail url='http://i.ytimg.com/vi/eDiF7jVsoAQ/1.jpg' height='90' width='120' time='00:01:03.250'/>
  <media:thumbnail url='http://i.ytimg.com/vi/eDiF7jVsoAQ/2.jpg' height='90' width='120' time='00:02:06.500'/>
  <media:thumbnail url='http://i.ytimg.com/vi/eDiF7jVsoAQ/3.jpg' height='90' width='120' time='00:03:09.750'/>
  <media:title type='plain'>Handelswetenschappen aan de HUB</media:title>
  <yt:duration seconds='253'/>
</media:group>

With the code above, I am able to fetch the title and description.
What I need to know is how to get the link, so actually an attribute of the item ‘link’, the media:content url or the media:player url.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:10:11+00:00Added an answer on May 29, 2026 at 10:10 am
    $link  = $element->getAttribute("href");
    

    So I guess you’ll want something like this, modify the line where you’ve written:

    'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
    

    Change it to this:

    'link' => $node->getElementsByTagName('link')->getAttribute('href'),
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: page = Net::HTTP.get_response(URI.parse('http://www.enhancetv.com.au/tvguide/rss/melbournerss.php')).body rescue nil show_info = Hash.from_xml(page).to_json puts
I have the following code that converts my twitter account rss feed into a
I have the following code: require 'rubygems' require 'net/http' require 'uri' url = URI.parse('http://servername.tld/up.txt')
I have the following code to view a remotely hosted video file: startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(article.getLink())));
I have the following code : XDocument xResponse = XDocument.Parse(strXMLResponse); var vMyData = from
I have the following Python code: import xml.dom.minidom import xml.parsers.expat try: domTree = ml.dom.minidom.parse(myXMLFileName)
I have following code class User attr_accessor :name end u = User.new u.name =
I need to parse json object for this url I have used following code
I have the following code, which is supposed to try to parse a given
I have the following code to parse the country when the autocomplete list is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.