Конечно, это можно сделать:
Просто посмотрите на эту функцию и используйте ее, как вам нравится:
function html2txt ($document)
{
$search = array (
"'<script[^>]*?>.*?</script>'si", // Strip out JavaScript code
"'<[\/\!]*?[^<>]*?>'si", // Strip out HTML tags
"'([\r\n])[\s]+'", // Strip out white space
"'@<![\s\S]*?�[ \t\n\r]*>@'",
"'&(quot|#34|#034|#x22);'i", // Replace HTML entities
"'&(amp|#38|#038|#x26);'i", // Added hexadecimal values
"'&(lt|#60|#060|#x3c);'i",
"'&(gt|#62|#062|#x3e);'i",
"'&(nbsp|#160|#xa0);'i",
"'&(iexcl|#161);'i",
"'&(cent|#162);'i",
"'&(pound|#163);'i",
"'&(copy|#169);'i",
"'&(reg|#174);'i",
"'&(deg|#176);'i",
"'&(#39|#039|#x27);'",
"'&(euro|#8364);'i", // Europe
"'&a(uml|UML);'", // German
"'&o(uml|UML);'",
"'&u(uml|UML);'",
"'&A(uml|UML);'",
"'&O(uml|UML);'",
"'&U(uml|UML);'",
"'ß'i",
);
$replace = array ( "",
"",
" ",
"\"",
"&",
"<",
">",
" ",
chr(161),
chr(162),
chr(163),
chr(169),
chr(174),
chr(176),
chr(39),
chr(128),
"ä",
"ö",
"ü",
"�",
"�",
"�",
"�",
);
$text = preg_replace($search, $replace, $document);
return trim ($text);
}