|
| |
|
|
| |
для: Unkind
(14.01.2007 в 02:31)
| | | Не совсем то получается, что нужно.Неточно я сформулировал вопрос... Вот например код:
<?php
header("Content-Type: text/plain");
$trans = 'http://www.beeonline.ru/demo/chat?chat=mms';
$contents = file_get_contents($trans);
$contents = strip_tags($contents);
echo $contents;
?>
|
1) Нужно из выводимого текста удалить конструкцию:
P { margin:0; }
.chat { font-weight:bold; font-style: italic; }
.user { margin-left:1em; margin-top:1em; font-weight:bold; color:darkblue; font-size:1.3em;}
.text { margin-left:2em; font-weight:bold; font-size:1.5em;}
.message { margin-left:2em; font-weight:bold; font-size:1.1em; color:red;}
.nick { font-weight:bold; }
.chatname { font-weight:bold; color:white; background-color:orange; font-size:2em;}
td { font-weight:bold; color:white; background-color:orange; font-size:2em;}
.melody { display:none; }
function music(){ var buttons = document.all.tags('BUTTON'); if ( buttons != null && buttons.length > 0 )
{ buttons[ 0 ].click(); } }
|
2)Все переводы строки заменить на <ems:br> (весь текст нужен в одну строку, с <ems:br> вместо переводов строк)
3)Через каждые 450 символов вставить в полученную строку \r\n | |
| |
|
|
| |
|
|
| |
для: loneliness
(14.01.2007 в 02:24)
| | | Можно попробовать так:
<?php
function get_content($url, $width = 450)
{
$buffer = file_get_contents($url);
$buffer = strip_tags($buffer);
$buffer = wordwrap($buffer, $width, "<br />\n");
while(strpos($buffer, " ") !== false)
{
$buffer = str_replace(" ", " ", $buffer);
}
while(strpos($buffer, chr(10).chr(10)) !== false)
{
$buffer = str_replace(chr(10).chr(10), chr(10), $buffer);
}
return $buffer;
}
$content = get_content('http://www.beeonline.ru/demo/chat?chat=mms');
$fd = fopen('file.txt', 'w');
if($fd)
{
fwrite($fd, $content);
fclose($fd);
}
else
{
echo("Не удалось записать информацию в файл.<br />\n");
}
?>
|
| |
| |
|
|
| |
|
|
| | Есть сайт, например http://www.beeonline.ru/demo/chat?chat=mms
Нужно записать содержимое страницы, как оно видится в браузере(текст) в файл *.txt и поделить его в этом файле переносом строки через каждые 450 символов, но так чтобы не разрывало слова.
Буду очень благодарен за примеры кода. | |
| |
|
|
|