Have you tried: (haven't tested)
PHP Code:$obj = simplexml_load_file($rss_source);
foreach($obj->entry as $child)
{
echo "<li><a href='".$child->link->attributes()->href."'>".$child->title."</a></li>";
print_r($link);
}
}
If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the largest domain name community on the internet and continues to grow every day. There are over 105,000 domainers on DNForum doing everything from buying domains, selling domains, learning about domains and discussing domains. Take a minute and Register.
Register Today on DNForum IT'S FREE!I am trying to parse an xml object. Each element in the object looks like this:
I am able to get the list of titles no problem but I do not know how to get the href attribute of the link node. Can someone help. Here is my php code which works:Code:[entry] => Array ( [0] => SimpleXMLElement Object ( [title] => Title of the thing [link] => SimpleXMLElement Object ( [@attributes] => Array ( [rel] => alternate [type] => text/html [href] => http://www.thelinkurl.com ) ) ) [1] => SimpleXMLElement Object ( [title] => Title of the number 2 thing [link] => SimpleXMLElement Object ( [@attributes] => Array ( [rel] => alternate [type] => text/html [href] => http://www.thelinkurlfornumber2.com ) ) )
What do I put in the # to get the @href attribute??PHP Code:$obj = simplexml_load_file($rss_source);
foreach($obj->entry as $child)
{
echo "<li><a href='#'>".$child->title."</a></li>";
print_r($link);
}
Have you tried: (haven't tested)
PHP Code:$obj = simplexml_load_file($rss_source);
foreach($obj->entry as $child)
{
echo "<li><a href='".$child->link->attributes()->href."'>".$child->title."</a></li>";
print_r($link);
}
}
Canadian Registrar ~~ Ready.ca
No problem Stu!!
Canadian Registrar ~~ Ready.ca
Bookmarks