Actualiser api.php
This commit is contained in:
@@ -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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user