loadHTML(mb_convert_encoding(file_get_contents($url), 'HTML-ENTITIES', 'UTF-8')); libxml_clear_errors(); foreach ( $doc->getElementsByTagName('meta') as $metaEl ) { $key = $metaEl->getAttribute('name') ?: $metaEl->getAttribute('property') ?: $metaEl->getAttribute('itemprop'); $value = $metaEl->getAttribute('content'); if ( !$key && !$value ) { continue; } if (!array_key_exists($key, $metadata)) { $metadata[$key] = $value; } elseif (!in_array($content, explode('\n', $metadata[$key]))) { $metadata[$key] .= "\n{$value}"; } } } else { } } } $description = 'View ' . ($metadata['og:title']?: 'this content') . ' on ' . $APP_NAME; ?>