Тема: rss reader php
Показать сообщение отдельно

  #25  
Старый 01.07.2008, 15:43
Solker
Участник форума
Регистрация: 04.05.2006
Сообщений: 161
Провел на форуме:
389768

Репутация: 158
По умолчанию

.::BARS::. ты Олень Ленивый.

PHP код:
<?php 

$file 
file_get_contents('http://bash.org.ru/rss/'); 

preg_match_all('#<title>Цитата \#([0-9]+)</title>#i',$file,$id);
preg_match_all('#<pubDate>(.+)</pubDate>#i',$file,$time); 
preg_match_all('#<description><!\[CDATA\[(.+)\]\]></description>#i',$file,$content); 

$filename "quotes.txt";
$handle fopen($filename"a+");
$cont = @fread($handlefilesize($filename));

for(
$i=0;$i<count($id[1]);$i++)
{
    if(
strpos($cont,$id[1][$i])) continue;
    
$str "[{$id[1][$i]}][{$time[1][$i]}]\r\n{$content[1][$i]}\r\n";
    
fwrite($handle$str);
}

fclose($handle);

echo 
'Done!';

?>

Последний раз редактировалось Solker; 01.07.2008 в 15:46..
 
Ответить с цитированием