Page 1 of 1

atom.xml retrieve link ....

Posted: Sat Aug 18, 2007 4:52 am
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

Posted: Sat Aug 18, 2007 8:54 am
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.

Posted: Sat Aug 18, 2007 5:18 pm
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