' . htmlspecialchars(json_encode($json, JSON_PRETTY_PRINT)) . ''; } // Get current settings $settings = getRetroAchievementsSettings(); // Output page ?>
Note: This test script uses the official RetroAchievements API at api.retroachievements.org which should bypass Cloudflare protection.
Enabled:
Mode:
Username:
API Key:
Proxy URL:
isset($_POST['ra_enabled']), 'mode' => $_POST['ra_mode'], 'username' => $_POST['ra_username'], 'api_key' => $_POST['ra_api_key'], 'proxy_url' => $_POST['ra_proxy_url'], 'override_local_images' => $settings['override_local_images'] ?? true ]; if (saveRetroAchievementsSettings($newSettings)) { echo 'Settings saved successfully! Refresh the page to continue testing.
'; } else { echo 'Failed to save settings. Check file permissions.
'; } } ?>API Connection successful!
'; echo 'Retrieved console data:
'; echo prettyJson($result); } else { echo 'API Connection failed. Check your settings and try again.
'; // Try to show detailed error information if ($settings['mode'] === 'direct') { $url = RA_API_BASE_URL . $endpoint . '.php?' . http_build_query([ 'z' => $settings['username'], 'y' => $settings['api_key'] ]); echo 'Attempted URL: ' . htmlspecialchars($url) . '
'; // Try a manual curl request for debugging $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_USERAGENT, 'RetroHub/1.0'); curl_setopt($curl, CURLOPT_VERBOSE, true); $verboseLog = fopen('php://temp', 'w+'); curl_setopt($curl, CURLOPT_STDERR, $verboseLog); $response = curl_exec($curl); $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); $error = curl_error($curl); rewind($verboseLog); $verboseOutput = stream_get_contents($verboseLog); curl_close($curl); echo 'HTTP Status Code: ' . $httpCode . '
'; if ($error) { echo 'Error: ' . htmlspecialchars($error) . '
'; } echo '' . htmlspecialchars($verboseOutput) . ''; if (!empty($response)) { echo '
' . htmlspecialchars($response) . ''; } } else { // For proxy mode, show the proxy URL echo '
Proxy URL: ' . htmlspecialchars($settings['proxy_url']) . '
'; echo 'Check that your proxy server is correctly configured.
'; } } } } ?>Game metadata found!
'; echo 'Icon:
'; echo 'Title Screenshot:
'; echo 'Ingame Screenshot:
'; echo 'Box Art:
'; echo 'No metadata found for this game.
'; // Try to display more debugging information echo 'Game title being searched: ' . htmlspecialchars($gameTitle) . '
'; echo 'Cleaned title: ' . htmlspecialchars(cleanGameTitle($gameTitle)) . '
'; // Try a direct API call to show available games $consoleId = $RA_CONSOLE_IDS[$console]; echo 'Attempting direct search using ConsoleID: ' . $consoleId . '
'; if ($settings['mode'] === 'direct') { $endpoint = 'GetGameList'; $params = [ 'i' => $consoleId, 'f' => cleanGameTitle($gameTitle), 'z' => $settings['username'], 'y' => $settings['api_key'] ]; $url = RA_API_BASE_URL . $endpoint . '.php?' . http_build_query($params); echo 'URL being requested: ' . htmlspecialchars($url) . '
'; $response = @file_get_contents($url); if ($response) { echo 'Direct API search returned data:
'; echo prettyJson($response); } else { echo 'Direct API search failed. Error: ' . error_get_last()['message'] . '
'; // Try curl as a fallback $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_USERAGENT, 'RetroHub/1.0'); $response = curl_exec($curl); $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); if ($response) { echo 'Direct API search with curl returned data:
'; echo prettyJson($response); } else { echo 'Direct API search with curl failed. HTTP Status: ' . $httpCode . '
'; } } } else { echo 'Using proxy mode. Cannot show direct API call.
'; } } } } ?>Cache has been cleared. Try searching for a game again.
'; } ?>