$filename = "blogxmls";
$arq = fopen($filename, "r") or die("Can't open file.");
$i = 0;
$cont = 0;
$trick = 0;
$num_linhas = count(file($filename));
while( $cont < $num_linhas )
#while(!feof($arq))
{
$url = fgets($arq, 128);
$sites[$i] = $url;
$sites[$i] = rtrim($sites[$i]);
$rss = @fetch_rss($sites[$i]);
$posicx = strpos($rss->channel['title'], "-");
$posicy = strpos($rss->channel['title'], ":");
if ( $trick == 3 ) { echo "
"; $trick = 0; }
if ( $posicx ) {
# echo "POSICAO X: " . $posicx; DEBUG X
echo "
" . substr($rss->channel['title'], 0, $posicx); # $rss->channel['title'];
" |
|---|
| ";
}
if ( $posicy ) {
# echo "POSICAO Y: " . $posicy; DEBUG Y
echo "
" . substr($rss->channel['title'], 0, $posicy); # $rss->channel['title'];
" |
|---|
| ";
}
if (!($posicx) && !($posicy)) {
# echo "Nao tem X nem Y!"; DEBUG POSICAO
echo "
" . $rss->channel['title'];
" |
|---|
| ";
}
$ItemCount = 0;
if (!$rss)
echo "Erro ao obter informações";
$oldErrorReportingValue = error_reporting(0);
foreach ($rss->items as $item) {
$title = $item['title'];
$href = $item['link'];
$desc = strip_tags($item['description']);
if (isset($item['pubDate'])) {
$item['pubdate'] = $item['pubDate'];
}
if (isset($item['dc']['date'])) {
$item['pubdate'] = preg_replace('/(....-..-..)T(..:..:..)([+-])(..):(..)/', "\\1 \\2 \\3\\4\\5", $item['dc']['date']);
# $item['pubdate'] = ereg_replace('(....-..-..)T(..:..:..)([+-])(..):(..)', "\\1 \\2 \\3\\4\\5", $item['dc']['date']);
}
if (isset($item['published'])) {
$item['pubdate'] = preg_replace('/(....-..-..)T(..:..:..)Z/', "\\1 \\2 +0000", $item['published']);
# $item['pubdate'] = ereg_replace('(....-..-..)T(..:..:..)Z', "\\1 \\2 +0000", $item['published']);
}
if (isset($item['pubdate'])) {
$pubDate = $item['pubdate'];
$timestamp = strtotime($pubDate);
# $pubDate = date("m-d-Y H:i:s", $timestamp);
$pubDate = date("D, d M Y H:i:s O", $timestamp);
} else {
# $pubDate = date("m-d-Y H:i:s", time());
$pubDate = date("D, d M Y H:i:s O", $timestamp);
}
$trimmed = trim($title, " ");
$result = substr($trimmed, 0,32);
$low = ucfirst(strtolower($result));
echo "
| ";
$ItemCount++;
if ($ItemCount >= 15) { break; }
}
echo "
|
";
$trick++;
$cont++;
} fclose($arq);
$last = date ("d.m.y H:i:s.", getlastmod());
?>
|
|