assign('includetext',$includetext); // get xml-data $data = @file_get_contents($url); // check data if ($data !== false && strpos($data, 'rss version=') !== false) { // parse XML try { // get SimpleXML-object $xml = new SimpleXMLElement($data); $i=0; $headlines = array(); // walk through items foreach($xml->channel->item as $item) { // check length if($items != 0 && $i >= $items) { break; } else { // add html if ($includetext) { // fill array $rss[] = array( 'pubDate' => strftime('%e. %B %Y',strtotime($item->pubDate)), 'title' => $item->title, 'link' => $item->link, 'description' => $item->description ); // increment counter $i++; } // htmlspecialchars_decode() works around inconsistent HTML encoding // e.g. in SMF Forum Threads else if (!in_array(htmlspecialchars_decode($item->title),$headlines) && strpos($item->title,'VERSCHOBEN') === FALSE) // hack to exclude forum thread-move messages { // fill array $rss[] = array( 'pubDate' => strftime('%e. %B %Y',strtotime($item->pubDate)), 'title' => $item->title, 'link' => $item->link ); $headlines[] = "" . htmlspecialchars_decode($item->title); // increment counter $i++; } } } } catch(Exception $e) { } } } // return return $rss; } } ?>