/ Published in: PHP
i could put a demo of this in action if you want
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $feedURL = 'http://mydomain.com/rss/example.xml'; $xml->registerXPathNamespace('atom', 'http://www.w3.org/2005/Atom'); // define namespace atom class oEntry { public $url; public $author; public $date; public $text; function oEntry($url, $author, $date, $text) { $this->url = $url; $this->author = $author; $this->text = $text; } } foreach($xml->xpath('atom:entry') as $entry) { // array of objects } // end foreach ?> SAMPLE XML INPUT (you need to fill out the tags): <?xml version="1.0" encoding="UTF-8"?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0"> <link rel="alternate" type="text/html" href="" /> <id></id> <updated></updated> <title></title> <entry> <id></id> <thr:in-reply-to ref="" type="text/html" href=""/> <link rel="alternate" type="text/html" href="" /> <title></title> <author> <name></name> <uri></uri> </author> <content type="html" xml:lang="en-us" xml:base=""> <![CDATA[<p>html text goes here</p>]]> </content> <published>February 20, 2010 2:23 AM</published> </entry> </feed>