";
+ } else {
+ // Notify the user of the final URL after following redirects
+ if ($url !== $finalUrl) {
+ $finalUrlEncoded = urlencode($finalUrl);
+ echo "
";
+ }
+
+ // Load HTML content into DOMDocument
+ $doc = new DOMDocument();
+ libxml_use_internal_errors(true); // Ignore HTML warnings
+ $doc->loadHTML($htmlContent);
+ libxml_clear_errors();
+
+ // Look for tag
+ $metaTags = $doc->getElementsByTagName('meta');
+ $metaData = [];
+
+ foreach ($metaTags as $meta) {
+ $name = $meta->getAttribute('name') ?: $meta->getAttribute('property') ?: $meta->getAttribute('itemprop');
+ $content = $meta->getAttribute('content');
+ if ($name && $content) {
+ if (!array_key_exists($name, $metaData)) {
+ $metaData[$name] = $content;
+ } elseif (!in_array($content, explode(' ', $metaData[$name]))) {
+ //$metaData["item-{$name}"] = $content;
+ $metaData[$name] .= ' ' . $content;
+ }
+ }
+ }
+
+ if ($metaData) {
+// Define names, emoji icons, and descriptions for common meta tags
+$metaFriendlyNames = [
+ // HTML Standard Meta Tags
+ 'title' => ['name' => 'Page Title', 'icon' => 'đ', 'description' => 'The title of the webpage, shown on the browser tab.'],
+ 'description' => ['name' => 'Description', 'icon' => 'đ', 'description' => 'A short summary of the page content.'],
+ 'keywords' => ['name' => 'Keywords', 'icon' => 'đ', 'description' => 'A list of keywords relevant to the page, used for SEO.'],
+ 'author' => ['name' => 'Author', 'icon' => 'âī¸', 'description' => 'The author of the webpage.'],
+ 'robots' => ['name' => 'Robots', 'icon' => 'đ¤', 'description' => 'Instructions for search engines on whether to index the page.'],
+ 'viewport' => ['name' => 'Viewport', 'icon' => 'đą', 'description' => 'Defines the visible area of the webpage on different devices.'],
+ 'charset' => ['name' => 'Charset', 'icon' => 'đ ', 'description' => 'Character encoding used by the page.'],
+
+ // Open Graph Meta Tags
+ 'og:title' => ['name' => 'OG Title', 'icon' => 'đ', 'description' => 'The title of the page when shared on social platforms.'],
+ 'og:description' => ['name' => 'OG Description', 'icon' => 'đ', 'description' => 'A brief description for social sharing.'],
+ 'og:image' => ['name' => 'OG Image', 'icon' => 'đŧī¸', 'description' => 'The image displayed when the page is shared.'],
+ 'og:url' => ['name' => 'OG URL', 'icon' => 'đ', 'description' => 'Canonical URL of the page being shared.'],
+ 'og:type' => ['name' => 'OG Type', 'icon' => 'đ', 'description' => 'The type of content (e.g., article, website, video).'],
+ 'og:site_name' => ['name' => 'OG Site Name', 'icon' => 'đ ', 'description' => 'The name of the website.'],
+ 'og:locale' => ['name' => 'OG Locale', 'icon' => 'đ', 'description' => 'The locale of the page (e.g., en_US).'],
+
+ // Twitter Meta Tags
+ 'twitter:title' => ['name' => 'Twitter Title', 'icon' => 'đĻ', 'description' => 'The title of the page when shared on Twitter.'],
+ 'twitter:description' => ['name' => 'Twitter Description', 'icon' => 'đĻđ', 'description' => 'A brief description for Twitter sharing.'],
+ 'twitter:image' => ['name' => 'Twitter Image', 'icon' => 'đĻđŧī¸', 'description' => 'The image displayed when the page is shared on Twitter.'],
+ 'twitter:card' => ['name' => 'Twitter Card', 'icon' => 'đĻđ', 'description' => 'The type of Twitter card to display (e.g., summary, player).'],
+
+ // Other common meta tags
+ 'canonical' => ['name' => 'Canonical URL', 'icon' => 'đ', 'description' => 'The preferred URL for the page, used to avoid duplicate content.'],
+];
+
+// Display meta tags in table format with names, icons, and raw names
+echo "
";
+echo "
Meta Tag
Value
";
+
+foreach ($metaData as $key => $value) {
+ $friendlyName = $metaFriendlyNames[$key]['name'] ?? ''; // Use friendly name if available
+ $icon = $metaFriendlyNames[$key]['icon'] ?? 'âšī¸'; // Use icon if available
+
+ // Update table row to include icon, friendly name, and raw name
+ echo "
+
+ $icon
+ {$friendlyName} ($key)
+
+
$value
+
";
+}
+
+echo "
";
+ } else {
+ echo "
No meta tags found on the provided URL.
";
+ }
+
+$linkTags = extractLinkTags($htmlContent);
+
+if ($linkTags) {
+// Display the table with elements
+echo "