= htmlspecialchars($ogData['title']) ?>
= htmlspecialchars($ogData['description']) ?>
cache('og'); $cacheKey = md5($url); $ogData = $cache->get($cacheKey); if ($ogData === null) { $ogData = [ 'title' => '', 'description' => '', 'image' => '', 'site_name' => '', 'url' => $url, ]; $context = stream_context_create([ 'http' => [ 'method' => 'GET', 'header' => 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36', 'timeout' => 10, ], 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false, ], ]); $html = @file_get_contents($url, false, $context); if ($html !== false) { // Parse OG meta tags (both property...content and content...property orders) preg_match_all('/ $property) { $prop = $property ?: $matches[4][$index]; $content = $matches[2][$index] ?: $matches[3][$index]; $content = html_entity_decode(trim($content), ENT_QUOTES | ENT_HTML5, 'UTF-8'); switch ($prop) { case 'title': $ogData['title'] = $content; break; case 'description': $ogData['description'] = $content; break; case 'image': $ogData['image'] = $content; break; case 'site_name': $ogData['site_name'] = $content; break; } } } // Fallback: use
= htmlspecialchars($ogData['description']) ?>