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

  • SEARCH
  • Home
  • 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 6180115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:47:26+00:00 2026-05-24T00:47:26+00:00

Here is the code I have written, It should fetch the first entry in

  • 0

Here is the code I have written, It should fetch the first entry in the atom feed from GitHub and display the commit description and a link to the commit on GitHub:

$url = "https://github.com/moodle/moodle/commits/master.atom";
$rss = simplexml_load_file($url);
if($rss) {
$items = $rss->entry;
$i = 0;
foreach($items as $item) {
    $title = $item->title;
    $link = $item->link;
    echo '<li class="github">';
    echo '<span>GitHub - moodle:master</span>';
    foreach($link as $links) {
        echo $links->href;
        echo "<a href=".$links->href.">";
    }
    echo $title;
    echo '</a>';
    echo "</li>";

            if(++$i == 1) break;
}
}   

However I do not seem to be able to display the href from the link entity.

Can anyone explain or adjust the code to get the link displaying?

  • 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-24T00:47:27+00:00Added an answer on May 24, 2026 at 12:47 am

    Elements and attributes are handled differently in SimpleXML. You should be able to pull it out like this instead:

    foreach($link as $links) {
        echo $links['href'];
        echo "<a href=".$links['href'].">";
    }
    

    Also, you can check http://www.php.net/manual/en/simplexml.examples-basic.php to see some simple usage examples.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's a snippet of code from a shell script I have written: for src
I have written code which should call MSSQL 2005 procedure from my servlet. The
Here's the code I have: from cStringIO import StringIO from lxml import etree xml
I have this code here, {foreach from=$cart.cartItems item=item name=cart} <div id=cart2Produkt> <p>{if $item.Product.ID} <a
I have my code here, it works fine from my home, where my user
I have written a code that searches specific string from database table.what i want
i have written a small piece of code. This code first blocks the {SIGSEGV},
I have written code within Python that doesn't release memory the way it should.
I have written sub main () 'some code goes here end sub This is
enter code here I have a table on SQL server 2005 with bigint primary

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.