Actualiser api.php

This commit is contained in:
2026-06-21 16:34:20 +02:00
parent 12e52ed512
commit edc571209d
+12
View File
@@ -454,3 +454,15 @@ switch ($action) {
echo json_encode(["success" => true, "imported" => $imported, "stats" => $stats]); echo json_encode(["success" => true, "imported" => $imported, "stats" => $stats]);
break; break;
} }
function fetchPosterFromOMDb($title, $year) {
$apiKey = "VOTRE_CLE_OMDB"; // À ajouter dans votre table config
$url = "http://www.omdbapi.com/?t=" . urlencode($title) . "&y=" . $year . "&apikey=" . $apiKey;
$response = @file_get_contents($url);
$data = json_decode($response, true);
if (isset($data['Poster']) && $data['Poster'] !== 'N/A') {
return $data['Poster'];
}
return null;
}