Chaos343
08-16-2005, 03:37 PM
a few months ago i found this code that puts some rss news headlines on my site. it used to work perfect! now all of the sudden, it does not do anything and i have not changed it! anyone know what's going on? TIA. here is the code:
<?
// The @ is to supress the function´ errors
$newsfeed = 'http://rss.news.yahoo.com/rss/business';
$fp = @fopen($newsfeed, 'r');
while(!feof($fp)){
$row .= @fgets($fp, 4096);
}
@fclose($fp);
if( eregi('<item>(.*)</item>', $row, $rowitem ) ) {
$item = explode('<item>', $rowitem[0]);
for( $i = 5; $i < count($item) - 1; $i++ ) {
eregi('<title>(.*)</title>', $item[$i+1], $title );
eregi('<link>(.*)</link>', $item[$i+1], $link );
eregi('<pubDate>(.*)</pubDate>', $item[$i+1], $pubDate);
echo '<table width="468" border="0" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF"><tr><td align="center"><a href="' . $link[1] . '" target="_blank"><b>' . $title[1] . '</b></a><br>';
echo '' . $pubDate[1] . '</td></tr></table>';
}
}
?>
<?
// The @ is to supress the function´ errors
$newsfeed = 'http://rss.news.yahoo.com/rss/business';
$fp = @fopen($newsfeed, 'r');
while(!feof($fp)){
$row .= @fgets($fp, 4096);
}
@fclose($fp);
if( eregi('<item>(.*)</item>', $row, $rowitem ) ) {
$item = explode('<item>', $rowitem[0]);
for( $i = 5; $i < count($item) - 1; $i++ ) {
eregi('<title>(.*)</title>', $item[$i+1], $title );
eregi('<link>(.*)</link>', $item[$i+1], $link );
eregi('<pubDate>(.*)</pubDate>', $item[$i+1], $pubDate);
echo '<table width="468" border="0" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF"><tr><td align="center"><a href="' . $link[1] . '" target="_blank"><b>' . $title[1] . '</b></a><br>';
echo '' . $pubDate[1] . '</td></tr></table>';
}
}
?>