Galera, é o seguinte, eu utilizo um RSS esterno que sempre funcionou, porém, nos últimos dias, comecei a ter problemas com a acentuação de um dos portais.
Vejam:
http://www.siderleygodoy.net46.net/rssstf/rss.php (perfeito)
no entanto:
http://www.siderleygodoy.net46.net/conjur/rss.php (esse com problemas)
segue o código php do rss:
<?php
[font='Times New Roman'] include "./rss_export.php";[/font]
[font='Times New Roman'] $rss_feed="[http://www.conjur.com.br/rss.xml";[/font]](http://www.conjur.com.br/rss.xml)
[font='Times New Roman'] $template="template.tpl";[/font]
[font='Times New Roman'] $DateFormat="d/m/y"; [/font]
[font='Times New Roman'][/font]
[font='Times New Roman']if (isset($_REQUEST["RSSFILE"])) {[/font]
[font='Times New Roman'] $rss_feed = $_REQUEST["RSSFILE"];[/font]
[font='Times New Roman']}[/font]
[font='Times New Roman']if (isset($_REQUEST["TEMPLATE"])) {[/font]
[font='Times New Roman'] $template = $_REQUEST["TEMPLATE"];[/font]
[font='Times New Roman']}[/font]
[font='Times New Roman']$FeedMaxItems = 5000;[/font]
[font='Times New Roman']if (isset($_REQUEST["MAXITEMS"])) {[/font]
[font='Times New Roman'] $FeedMaxItems = $_REQUEST["MAXITEMS"];[/font]
[font='Times New Roman']}[/font]
[font='Times New Roman']$RandomItems=0;[/font]
[font='Times New Roman']if (isset($_REQUEST["RANDOM"])) {[/font]
[font='Times New Roman'] $RandomItems = $_REQUEST["RANDOM"];[/font]
[font='Times New Roman']}[/font]
[font='Times New Roman'] error_reporting(E_ERROR); [/font]
[font='Times New Roman'] $rss = new RSS_export; [/font]
[font='Times New Roman'] $rss->cache_dir = './temp'; [/font]
[font='Times New Roman'] $rss->cache_time = 1200; [/font]
[font='Times New Roman'] $from = 1;[/font]
[font='Times New Roman'] $rss->date_format = $DateFormat;[/font]
[font='Times New Roman'] if ($rs = $rss->get($rss_feed)) [/font]
[font='Times New Roman'] { [/font]
[font='Times New Roman'] $theData = file($template);[/font]
[font='Times New Roman'] $count = 0;[/font]
[font='Times New Roman'] $from = -1;[/font]
[font='Times New Roman'] foreach($theData as $line)[/font]
[font='Times New Roman'] {[/font]
[font='Times New Roman'] if ((strstr($line,"NOCRLF=")) || (strstr($line,"NAME=")) || (strstr($line,"FILEEXT=")) || (strstr($line,"DATEFORMAT=")) || (strstr($line,"TIMEFORMAT="))) {[/font]
[font='Times New Roman'] $line="";[/font]
[font='Times New Roman'] } [/font]
[font='Times New Roman'] $line=str_replace("%Copyright%", "$rs[copyright]\n", $line); [/font]
[font='Times New Roman'] $line=str_replace("%Copyright%", "", $line); [/font]
[font='Times New Roman'] $line=str_replace("%Language%", "$rs[language]\n", $line); [/font]
[font='Times New Roman'] $line=str_replace("%Language%", "", $line); [/font]
[font='Times New Roman'] $line=str_replace("%Editor%", "$rs[managingEditor]\n", $line); [/font]
[font='Times New Roman'] $line=str_replace("%Editor%", "", $line); [/font]
[font='Times New Roman'] $line=str_replace("%Webmaster%", "$rs[webMaster]\n", $line); [/font]
[font='Times New Roman'] $line=str_replace("%Webmaster%", "", $line); [/font]
[font='Times New Roman'] $line=str_replace("%FeedPubTime%", "$rs[lastBuildDate]\n", $line); [/font]
[font='Times New Roman'] $line=str_replace("%FeedPubTime%", "", $line); [/font]
[font='Times New Roman'] $line=str_replace("%Rating%", "$rs[rating]\n", $line); [/font]
[font='Times New Roman'] $line=str_replace("%Rating%", "", $line); [/font]
[font='Times New Roman'] $line=str_replace("%Docs%", "$rs[docs]\n", $line); [/font]
[font='Times New Roman'] $line=str_replace("%Docs%", "", $line); [/font]
[font='Times New Roman'] $line=str_replace("%FeedTitle%", "$rs[title]\n", $line); [/font]
[font='Times New Roman'] // $line=str_replace("%FeedLink%", "<a href=\"$rs[link]\">$rs[title]</a>\n", $line); [/font]
[font='Times New Roman'] $line=str_replace("%FeedLink%", "$rs[link]\n", $line); [/font]
[font='Times New Roman'] $line=str_replace("%FeedDescription%", $rs[description], $line);[/font]
[font='Times New Roman'] $line=str_replace("<", "<", $line);[/font]
[font='Times New Roman'] $line=str_replace(">", ">", $line);[/font]
[font='Times New Roman'] $line=str_replace(" ", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace(""", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("©", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("®", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("™", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("€", "?", $line);[/font]
[font='Times New Roman'] $line=str_replace("„", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("“", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("«", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("»", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("§", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("&", "&", $line);[/font]
[font='Times New Roman'] $line=str_replace("—", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("'", "'", $line);[/font]
[font='Times New Roman'] if ($rs['image_url'] != '') { [/font]
[font='Times New Roman'] $line=str_replace("%ImageItem%", "<a href=\"$rs[image_link]\"><img src=\"$rs[image_url]\" alt=\"$rs[image_title]\" vspace=\"1\" border=\"0\" /></a>\n", $line);[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] else {[/font]
[font='Times New Roman'] $line=str_replace("%ImageItem%", "", $line);[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] $count = $count+1;[/font]
[font='Times New Roman'] if (strstr($line,"%BeginItemsRecord%")){[/font]
[font='Times New Roman'] $from = $count; [/font]
[font='Times New Roman'] } [/font]
[font='Times New Roman'] if ($from == -1){ echo $line;}[/font]
[font='Times New Roman'] } [/font]
[font='Times New Roman'] $linecount = 0;[/font]
[font='Times New Roman'] foreach($rs['items'] as $item)[/font]
[font='Times New Roman'] {[/font]
[font='Times New Roman'] if ($RandomItems == 1) {[/font]
[font='Times New Roman'] $seeder = hexdec(substr(md5(microtime()), -8)) & 0x7fffffff;[/font]
[font='Times New Roman'] mt_srand($seeder);[/font]
[font='Times New Roman'] $c=mt_rand(0,1);[/font]
[font='Times New Roman'] if ($c == 0) {[/font]
[font='Times New Roman'] $seeder = hexdec(substr(md5(microtime()), -8)) & 0x7fffffff;[/font]
[font='Times New Roman'] mt_srand($seeder);[/font]
[font='Times New Roman'] continue;[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] } [/font]
[font='Times New Roman'] if ($linecount == $FeedMaxItems) {[/font]
[font='Times New Roman'] [/font]
[font='Times New Roman'] break;[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] ++$linecount;[/font]
[font='Times New Roman'] [/font]
[font='Times New Roman'] $strcount=0; [/font]
[font='Times New Roman'] foreach($theData as $line){[/font]
[font='Times New Roman'] $strcount=$strcount+1;[/font]
[font='Times New Roman'] if ($strcount>=$from){ [/font]
[font='Times New Roman'] $line=str_replace("%BeginItemsRecord%", "", $line);[/font]
[font='Times New Roman'] $line=str_replace("%ItemTitle%", $item['title'], $line);[/font]
[font='Times New Roman'] $line=str_replace("%ItemLink%", $item['link'], $line);[/font]
[font='Times New Roman'] $line=str_replace("%ItemDescription%",$item['description'], $line);[/font]
[font='Times New Roman'] $line=str_replace("%ItemPubTime%", $item['pubDate'], $line);[/font]
[font='Times New Roman'] $line=str_replace("%ItemPubTime%", "", $line);[/font]
[font='Times New Roman'] $line=str_replace("%EndItemsRecord%", "", $line);[/font]
[font='Times New Roman'] $line=str_replace("<", "<", $line);[/font]
[font='Times New Roman'] $line=str_replace(">", ">", $line);[/font]
[font='Times New Roman'] $line=str_replace(" ", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace(""", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("©", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("®", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("™", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("€", "?", $line);[/font]
[font='Times New Roman'] $line=str_replace("„", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("“", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("«", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("»", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("§", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("&", "&", $line);[/font]
[font='Times New Roman'] $line=str_replace("—", " ", $line);[/font]
[font='Times New Roman'] $line=str_replace("'", "'", $line);[/font]
[font='Times New Roman'] echo $line; [/font]
[font='Times New Roman'] } [/font]
[font='Times New Roman'] [/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] [/font]
[font='Times New Roman'] } echo "<style=\"font-size:10px\"></a>";[/font]
[font='Times New Roman'] [/font]
[font='Times New Roman'] } [/font]
[font='Times New Roman'] else [/font]
[font='Times New Roman'] { [/font]
[font='Times New Roman'] echo "Erro\n"; [/font]
[font='Times New Roman'] } [/font]
[font='Times New Roman']?> [/font]
[font='Times New Roman'][/font]
Exportando RSS
<?php
[font='Times New Roman']class RSS_export {[/font]
[font='Times New Roman'] var $channeltags = array ('title', 'link', 'description', 'language', 'copyright', 'managingEditor', 'webMaster', 'lastBuildDate', 'rating', 'docs');[/font]
[font='Times New Roman'] var $itemtags = array('title', 'link', 'description', 'pubDate');[/font]
[font='Times New Roman'] var $imagetags = array('title', 'url', 'link', 'width', 'height');[/font]
[font='Times New Roman'] var $textinputtags = array('title', 'description', 'name', 'link');[/font]
[font='Times New Roman'] function my_preg_match ($pattern, $subject) {[/font]
[font='Times New Roman'] preg_match($pattern, $subject, $out);[/font]
[font='Times New Roman'] if(isset($out[1])) {[/font]
[font='Times New Roman'] if ($this->CDATA == 'content') {$out[1] = strtr($out[1], array('<![CDATA['=>'', ']]>'=>''));}[/font]
[font='Times New Roman'] elseif ($this->CDATA == 'strip') {$out[1] = strtr($out[1], array('<![CDATA['=>'', ']]>'=>''));}[/font]
[font='Times New Roman'] if ($this->cp != '') $out[1] = iconv($this->rsscp, $this->cp.'//TRANSLIT', $out[1]);[/font]
[font='Times New Roman'] return trim($out[1]);}[/font]
[font='Times New Roman'] else {return '';}[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] function unhtmlentities ($string) {[/font]
[font='Times New Roman'] $trans_tbl = get_html_translation_table (HTML_ENTITIES, ENT_QUOTES);[/font]
[font='Times New Roman'] $trans_tbl = array_flip ($trans_tbl);[/font]
[font='Times New Roman'] $trans_tbl += array(''' => "'");[/font]
[font='Times New Roman'] return strtr ($string, $trans_tbl);[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] function Get ($rss_url) {[/font]
[font='Times New Roman'] if ($this->cache_dir != '') {[/font]
[font='Times New Roman'] $cache_file = $this->cache_dir . '/rsscache_' . md5($rss_url);[/font]
[font='Times New Roman'] $timedif = @(time() - filemtime($cache_file));[/font]
[font='Times New Roman'] if ($timedif < $this->cache_time) {[/font]
[font='Times New Roman'] $result = unserialize(join('', file($cache_file)));[/font]
[font='Times New Roman'] if ($result) $result['cached'] = 1;[/font]
[font='Times New Roman'] } else {[/font]
[font='Times New Roman'] $result = $this->Parse($rss_url);[/font]
[font='Times New Roman'] $serialized = serialize($result);[/font]
[font='Times New Roman'] if ($f = @fopen($cache_file, 'w')) {[/font]
[font='Times New Roman'] fwrite ($f, $serialized, strlen($serialized));[/font]
[font='Times New Roman'] fclose($f);[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] if ($result) $result['cached'] = 0;[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] else {[/font]
[font='Times New Roman'] $result = $this->Parse($rss_url);[/font]
[font='Times New Roman'] if ($result) $result['cached'] = 0;[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] return $result;[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] function Parse ($rss_url) {[/font]
[font='Times New Roman'] if ($f = @fopen($rss_url, 'r')) {[/font]
[font='Times New Roman'] $rss_content = '';[/font]
[font='Times New Roman'] while (!feof($f)) {[/font]
[font='Times New Roman'] $rss_content .= fgets($f, 4096);[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] fclose($f);[/font]
[font='Times New Roman'] $result['encoding'] = $this->my_preg_match("'encoding=
\'\"[\'\"]'si", $rss_content);[/font]
[font='Times New Roman'] if ($result['encoding'] != '')[/font]
[font='Times New Roman'] { $this->rsscp = $result['encoding']; }[/font]
[font='Times New Roman'] else[/font]
[font='Times New Roman'] { $this->rsscp = $this->default_cp; } [/font]
[font='Times New Roman'] preg_match("'<channel.*?>(.*?)</channel>'si", $rss_content, $out_channel);[/font]
[font='Times New Roman'] foreach($this->channeltags as $channeltag)[/font]
[font='Times New Roman'] {[/font]
[font='Times New Roman'] $temp = $this->my_preg_match("'<$channeltag.
?>(.?)</$channeltag>'si", $out_channel[1]);[/font]
[font='Times New Roman'] if ($temp != '') $result[$channeltag] = $temp; [/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] if ($this->date_format != '' && ($timestamp = strtotime($result['lastBuildDate'])) !==-1) {$result['lastBuildDate'] = date($this->date_format, $timestamp);}[/font]
[font='Times New Roman'] preg_match("'<textinput(|[^>]*[^/])>(.*?)</textinput>'si", $rss_content, $out_textinfo);[/font]
[font='Times New Roman'] if (isset($out_textinfo[2])) {[/font]
[font='Times New Roman'] foreach($this->textinputtags as $textinputtag) {$temp = $this->my_preg_match("'<$textinputtag.
?>(.?)</$textinputtag>'si", $out_textinfo[2]);[/font]
[font='Times New Roman'] if ($temp != '') $result['textinput_'.$textinputtag] = $temp;}[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] preg_match("'<image.
?>(.?)</image>'si", $rss_content, $out_imageinfo);[/font]
[font='Times New Roman'] if (isset($out_imageinfo[1])) {[/font]
[font='Times New Roman'] foreach($this->imagetags as $imagetag) {[/font]
[font='Times New Roman'] $temp = $this->my_preg_match("'<$imagetag.*?>(.*?)</$imagetag>'si", $out_imageinfo[1]);[/font]
[font='Times New Roman'] if ($temp != ''){$result[ 'image_'.$imagetag] = $temp;}[/font]
[font='Times New Roman'] else { $result[ 'image_'.$imagetag]="nope1"; }[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] preg_match_all("'<item(| .
?)>(.?)</item>'si", $rss_content, $items);[/font]
[font='Times New Roman'] $rss_items = $items[2];[/font]
[font='Times New Roman'] $i = 0;[/font]
[font='Times New Roman'] $result['items'] = array(); [/font]
[font='Times New Roman'] foreach($rss_items as $rss_item) {[/font]
[font='Times New Roman'] if ($i < $this->items_limit || $this->items_limit == 0) {[/font]
[font='Times New Roman'] foreach($this->itemtags as $itemtag) {[/font]
[font='Times New Roman'] $temp = $this->my_preg_match("'<$itemtag.*?>(.*?)</$itemtag>'si", $rss_item);[/font]
[font='Times New Roman'] if ($temp != '') $result['items'][$i][$itemtag] = $temp;[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] if ($this->stripHTML && $result['items'][$i]['description']) $result['items'][$i]['description'] = strip_tags($this->unhtmlentities(strip_tags($result['items'][$i]['description'])));[/font]
[font='Times New Roman'] if ($this->stripHTML && $result['items'][$i]['title']) $result['items'][$i]['title'] = strip_tags($this->unhtmlentities(strip_tags($result['items'][$i]['title'])));[/font]
[font='Times New Roman'] if ($this->date_format != '' && ($timestamp = strtotime($result['items'][$i]['pubDate'])) !==-1) {$result['items'][$i]['pubDate'] = date($this->date_format, $timestamp);}[/font]
[font='Times New Roman'] $i++;[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] $result['items_count'] = $i;[/font]
[font='Times New Roman'] return $result;[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] else[/font]
[font='Times New Roman'] {[/font]
[font='Times New Roman'] return False;[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman'] }[/font]
[font='Times New Roman']}[/font]
[font='Times New Roman']?>[/font]
[font='Times New Roman'][/font]