- $body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8");
-
- $doc = new DOMDocument();
- @$doc->loadHTML($body);
-
- deletenode($doc, 'style');
- deletenode($doc, 'script');
- deletenode($doc, 'option');
- deletenode($doc, 'h1');
- deletenode($doc, 'h2');
- deletenode($doc, 'h3');
- deletenode($doc, 'h4');
- deletenode($doc, 'h5');
- deletenode($doc, 'h6');
- deletenode($doc, 'ol');
- deletenode($doc, 'ul');
-
- $xpath = new DomXPath($doc);
-
- $list = $xpath->query("//meta[@content]");
- foreach ($list as $node) {
- $attr = array();
- if ($node->attributes->length)
- foreach ($node->attributes as $attribute)
- $attr[$attribute->name] = $attribute->value;
-
- if (@$attr["http-equiv"] == 'refresh') {
- $path = $attr["content"];
- $pathinfo = explode(";", $path);
- $content = "";
- foreach ($pathinfo AS $value) {
- if (substr(strtolower($value), 0, 4) == "url=")
- $content = substr($value, 4);
- }
- if ($content != "") {
- $siteinfo = parseurl_getsiteinfo($content, $no_guessing, $do_oembed, ++$count);
- return($siteinfo);
- }