Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // подключаем класс simple_html_dom для разбора html
- include_once('simple_html_dom.php');
- $html = file_get_html('http://www.google.com/');
- // что ищем
- $findme = 'Hello';
- // Find all
- foreach($html->find('offer') as $element) {
- $mystring = $element->innertext();
- $isFind = strpos($mystring, $findme);
- if ($isFind === false) {
- //не найдено
- //echo "Строка '$findme' не найдена в строке '$mystring1'";
- //if ($isFind === false)
- } else {
- //зачищаем
- $element->innertext('');
- }//else if ($isFind === false)
- }//foreach($html->find('offer') as $element)
- echo $html->innertext();
- $str = '<offer>Hello</offer>';
- echo preg_replace('~<offer>Hello</offer>~i', '', $str);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement