diff --git a/api.php b/api.php index a3289bf..3721687 100644 --- a/api.php +++ b/api.php @@ -689,5 +689,29 @@ switch ($action) { 'imgs' => $imgList ], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); break; + + case 'test_covercentury': + $title = $_GET['title'] ?? 'Matrix'; + $year = $_GET['year'] ?? ''; + + // URLs possibles à tester + $urls = [ + "https://www.covercentury.com/index.php?p=recherche&recherche=" . urlencode($title), + "https://www.covercentury.com/?s=" . urlencode($title), + "https://www.covercentury.com/search/" . urlencode($title), + "https://www.covercentury.com/index.php?recherche=" . urlencode($title), + ]; + + $results = []; + foreach ($urls as $url) { + $html = httpGet($url, 8); + $results[] = [ + 'url' => $url, + 'length' => $html ? strlen($html) : 0, + 'snippet' => $html ? substr(strip_tags($html), 0, 200) : 'ERREUR' + ]; + } + echo json_encode($results, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); + break; } ?> \ No newline at end of file