I am trying to retrieve RSS feed using php. The xml has many different nodes. I am not sure how to display <dc:>,<rdf:>,<syn:> node.
feed
<item>xxx</item>
....
....
<dc:name>John</dc:name> //I am not sure how to get this content
<dc:title>Manager</dc:title>
<syn:updateTime>1970-01-01</syn:updateTime>
<rdf:Seq>
<rdf:li rdf:resource="http://xxx/>
<rdf:li rdf:resource="http://xxx/>
</rdf:Seq>
php
$contents= file_get_contents($url);
$results=new SimpleXMLElement($contents);
//not sure what I can do to display those special nodes...
foreach ($results->channel as $node):
echo $node->item; //only show item content
endforeach;
Try this:
Then you can use print_r to dump the object
$xmlStror in a browswer
This way you can inspect the object if that is what you’re attempting to do. To access individual values/nodes:
and that should return the contents of the node.
Not sure what happens if you do this, but you can also try the following, but it depends on the content of
$xmlStrperhaps…: