<?
// Обновление 14.06.2009
// Использование скрипта - запускаем его http://путь_к_файлу?count=количество_обращений_к_серваку
header("Content-Type: text/html; charset=windows-1251");
$count = $_GET['count'];
$i=1;
$link = 'http://vesna.yandex.ru/estetica.xml'; // Откуда будем брать текст
echo "Задано ".$count." обращений к серверу Яндекса. Поехали...";
while ($i<=$count){
$content = file_get_contents($link);
preg_match_all('#<div.*?>(.*?)</div>#is', $content, $text);
$text = preg_replace('#<h1.*?</h1>#', '', $text[1][4]);
$text = preg_replace('#<h2>.*?</h2>#', '', $text);
$text = preg_replace('#<p>#', '', $text);
$text = preg_replace('#</p>#', '', $text);
$text = preg_replace('#\n#', '', $text);
$f = fopen("text.txt","a+");
fwrite($f, $text);
fwrite($f, "\r \n");
fclose($f);
$i++;
}
echo 'Готово';
?>