Skip to content

Commit

Permalink
Merge pull request #368 from Tanza3D/quickuser
Browse files Browse the repository at this point in the history
Quick user api
  • Loading branch information
Tanza3D authored Nov 30, 2023
2 parents 6f00afd + a6de29a commit 305f595
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions api/profiles/get_user.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
<?php
include_once($_SERVER['DOCUMENT_ROOT'] . "/global/php/functions.php");
header("Access-Control-Allow-Origin: *");

// return json
header('Content-Type: application/json');

if (isset($_GET['quick'])) {
$user = curlRequestUser(htmlspecialchars($_GET['id']));
echo json_encode($user);
exit;
}

$cache = Caching::getCache("profiles_" . $_GET['id']);

if($cache != null) {
if ($cache != null) {
echo $cache;
exit;
}
Expand All @@ -19,5 +26,3 @@
//$id = $_GET['id'];
//$rank = $user['pp_rank'];
//$username = $user['username'];

?>
1 change: 1 addition & 0 deletions global/php/osu_api_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function GetHeaders()

function curlRequestUser($strSearch)
{
if (IsExpired() == true) GetBearer();
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, "https://osu.ppy.sh/api/v2/users/" . $strSearch);
curl_setopt($handle, CURLOPT_HTTPHEADER, GetHeaders());
Expand Down

0 comments on commit 305f595

Please sign in to comment.