BlackHalt writeln (by me or from manual) PHP source Codes ...
Delfi RSS:
<?php error_reporting(0);
header('Content-type: text/xml; charset=windows-1257');
$timeout=3600;
if(time()-filemtime('delfi.txt')<$timeout){
$faa=file_get_contents('delfi.txt');
echo $faa;
exit;
}else{
ob_start();
echo<<<END_HEADER
<?xml version="1.0" encoding="windows-1257" ?>
<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule">
<channel>
<title>Delfi.lv</title>
<description>Delfi.lv RSS by <a href="http://neb.ija.lv/">BlackHalt</a></description>
<link>http://delfi.lv/</link>
<language>lv</language>
END_HEADER;
$url=file_get_contents('http://www.delfi.lv');
//pirmaa zinja
//<a class=fpArticleT href="
//</a>
$aa=explode('<a class=fpArticleT',$url);
$bb=explode('</a>',$aa[1]);
$bb[0]=str_replace(' href="/',' href="http://www.delfi.lv/',$bb[0]);
$ee=explode('">',$bb[0]);
$ff=explode('</a>',$ee[1]);
$ee[0]=str_replace(' href="','',$ee[0]);
$ff[0]=htmlspecialchars($ff[0]);
$ee[0]=htmlspecialchars($ee[0]);
echo'
<item>
<title>'.$ff[0].'</title>
<link>'.$ee[0].'</link>
</item>';
//paareejais
$html_start='<img src="http://g.delfi.lv/d/i/bullet.gif" border=0 width=8 height=11>';
$html_end='<br clear=all>';
$a=explode($html_start,$url);
$b=explode($html_end,$a[1]);
$c=count($a);
for($i=1;$i<$c;$i++){
$b=explode($html_end,$a[$i]);
$b[0]=str_replace(' href="/',' href="http://www.delfi.lv/',$b[0]);
$b[0]=preg_replace('/( <a href=").*?(\)<\/a>)/','',$b[0]);
$d=explode('<a class=fpArticleT href="',$b[0]);
//$d[0] <link>
$e=explode('">',$d[1]);
//$e[0] </link>
$f=explode('</a>',$e[1]);
//$f[0] </title>
$f[0]=htmlspecialchars($f[0]);
$e[0]=htmlspecialchars($e[0]);
echo'
<item>
<title>'.$f[0].'</title>
<link>'.$e[0].'</link>
</item>';
}
echo'
</channel>
</rss>';
$buffer=ob_get_clean();
$fh=fopen('delfi.txt','w+');
fwrite($fh,$buffer);
fclose($fh);
echo $buffer;
flush();
ob_end_flush();
}
?>