Free Website Audit
Unable to fetch the website. Please check the URL.'; } else { libxml_use_internal_errors(true); $doc = new DOMDocument(); $doc->loadHTML($html); $xpath = new DOMXPath($doc); $title = $xpath->query('//title')->item(0)->nodeValue ?? 'No title found'; $metaDesc = ''; foreach ($xpath->query('//meta') as $meta) { if (strtolower($meta->getAttribute('name')) === 'description') { $metaDesc = $meta->getAttribute('content'); break; } } $h1Tags = []; foreach ($xpath->query('//h1') as $h1) { $h1Tags[] = trim($h1->nodeValue); } $links = $xpath->query('//a[@href]'); $totalLinks = $links->length; $internal = 0; $external = 0; foreach ($links as $link) { $href = $link->getAttribute('href'); if (strpos($href, $url) !== false || str_starts_with($href, '/')) $internal++; else $external++; } echo '';
echo '
';
}
}
?>
Audit Results for ' . esc_html($url) . '
'; echo 'Title: ' . esc_html($title) . '
'; echo 'Meta Description: ' . esc_html($metaDesc ?: 'No meta description found') . '
'; echo 'H1 Tags: ' . ($h1Tags ? implode(', ', $h1Tags) : 'None') . '
'; echo 'Total Links: ' . $totalLinks . '
'; echo 'Internal Links: ' . $internal . '
'; echo 'External Links: ' . $external . '
'; echo '