registerXPathNamespace("dc", "http://purl.org/dc/elements/1.1/"); $rssHeaderContent = $rssContent->channel[0]; // $this->message("RSS content is ===========\n".var_export($rssHeaderContent, true)."==========="); $this->load_RSS_2_0_feed_data($rssHeaderContent); foreach($rssContent->item as $item) { $this->message("parsing item ".var_export($item, true)); $this->items[] = $this->parseRSSItem($item); } } protected function parseRSSItem($newsItem) { $item = new Item(); $item->title = trim($newsItem->title); $this->message("browsing Oatmeal item ".var_export($newsItem, true)); if(empty($newsItem->guid)) { $item->uri = $newsItem->link; } else { $item->uri = $newsItem->guid; } // now load that uri from cache $this->message("now loading page ".$item->uri); $articlePage = str_get_html($this->get_cached($item->uri)); $content = $articlePage->find('#comic', 0); if($content==null) { $content = $articlePage->find('#blog'); } $item->content = $content->innertext; $namespaces = $newsItem->getNameSpaces(true); $dc = $newsItem->children($namespaces['dc']); $this->message("dc content is ".var_export($dc, true)); $item->name = $dc->creator; $item->timestamp = DateTime::createFromFormat(DateTime::ISO8601, $dc->date)->getTimestamp(); $this->message("writtem by ".$item->name." on ".$item->timestamp); return $item; } public function getCacheDuration(){ return 7200; // 2h hours } }