= $ogData['title'] ?>
= $ogData['description'] ?>
'', 'description' => '', 'image' => '', 'site_name' => '', 'url' => $url ]; // Configuration du contexte pour éviter les erreurs SSL $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 ] ]); // Récupérer le HTML $html = @file_get_contents($url, false, $context); if ($html === false) { return $ogData; } // Parser les meta tags Open Graph preg_match_all('/ $property) { $content = $matches[2][$index]; switch ($property) { case 'title': $ogData['title'] = htmlspecialchars($content); break; case 'description': $ogData['description'] = htmlspecialchars($content); break; case 'image': $ogData['image'] = $content; break; case 'site_name': $ogData['site_name'] = htmlspecialchars($content); break; } } } // Fallback: si pas de og:title, utiliser