//Функция вырезает блоки из html страницы (массив)
function clear_t($t1, $t2, $content){
preg_match_all('~'.$t1.'[^>]+'.$t2.'~', $content, $txt);
$count= count($txt[0])-1;
for($i=0; $i<=$count; $i++)
{
$txt[0][$i] = substr($txt[0][$i], strlen($t1));
$txt[0][$i] = substr($txt[0][$i],0,-1*(strlen($t2)));
}
return $txt;
}
Жадный паттерн
function clear_t2($t1, $t2, $content){
preg_match_all('~'.$t1.'(.*)'.$t2.'~', $content, $txt);
$count= count($txt[0])-1;
for($i=0; $i<=$count; $i++)
{
$txt[0][$i] = substr($txt[0][$i], strlen($t1));
$txt[0][$i] = substr($txt[0][$i],0,-1*(strlen($t2)));
}
return $txt;
}
Парсинг HTML
Подписаться на:
Комментарии к сообщению (Atom)
Комментариев нет:
Отправить комментарий