You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Http;
|
|
|
|
class AchievementController2 extends Controller
|
|
{
|
|
public function showAchievements(){
|
|
return view('achievements');
|
|
}
|
|
public function getAchievements(Request $request)
|
|
{
|
|
$username = $request->input('username');
|
|
$gameId = $request->input('game_id');
|
|
$apiKey = 'nEkCuLsy6N2PZeiAAiUQ2oqqWOHXfrzP';
|
|
|
|
$apiUrl = 'https://retroachievements.org/API/API_GetGameInfoAndUserProgress.php';
|
|
|
|
// Make the API request using Axios or any other JavaScript-based HTTP client
|
|
// You can pass additional parameters or headers as needed
|
|
$response = Http::get($apiUrl, [
|
|
'webApiKey ' => $apiKey,
|
|
'userName ' => $username,
|
|
'gameId' => $gameId,
|
|
]);
|
|
|
|
return $response->json();
|
|
|
|
// Process the response
|
|
// ...
|
|
|
|
// Return the processed response
|
|
// ...
|
|
|
|
// You can store the processed response in the database, display it in a view, or return it as a JSON response.
|
|
}
|
|
}
|