diff --git a/api.php b/api.php index c0f198c..23b639a 100644 --- a/api.php +++ b/api.php @@ -453,4 +453,16 @@ switch ($action) { $pdo->commit(); echo json_encode(["success" => true, "imported" => $imported, "stats" => $stats]); 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; } \ No newline at end of file