atom.xml retrieve link ....

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
slyen
Forum Newbie
Posts: 3
Joined: Thu Aug 24, 2006 10:36 pm

atom.xml retrieve link ....

Post by slyen »

Hello,

I have php code question. I would like to retrieve its link from atom, but I don't know which object that I can use in php to retrieve it. The link tag looks different from the others. <link rel="alternate" href="XXX.html".... />. I used

Code: Select all

$dom = domxml_open_mem($xml);
$root = $dom->document_element();
$link = $root->get_element_by_tagname("link");
... loop 
<a href='".$link[$i]->get_content()."' .....></a>
My code doesn't work. It returns empty string. How do I retrieve the link tag which has href attributes... Can anyone help? I believe "link" is not considered as a tag afterall.. but which object in php I should use to solved this problem? any idea? help ...

Thanks
thewebdrivers
Forum Commoner
Posts: 41
Joined: Fri Aug 17, 2007 3:32 pm
Location: india
Contact:

Post by thewebdrivers »

I do not know quiet understand what you are trying to achieve but if you are trying to read rss/atom feeds, you can use magpie rss reader.
slyen
Forum Newbie
Posts: 3
Joined: Thu Aug 24, 2006 10:36 pm

Post by slyen »

Actually I don't know whether atom is RSS or not. I know that I can use domxml to retrive my some tag. This is why I am trying to use the same method. However, in the atom xml file, the link doesn't have a complete tag, which is <link></link>. In atom xml, it is like <link .... href="..."/>. This is why I cannot use the get_element_by_tagname('link').

I dont know more about the magpie reader, but I don't know how to use them. I am very new to the xml and rss.

I hope anyone can help me how to retrieve the "link".

Thanks
Post Reply