the browser-facing portion of osu!
at master 891 B view raw
1<?php 2 3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 4// See the LICENCE file in the repository root for full licence text. 5 6namespace App\Libraries; 7 8use GuzzleHttp\Client; 9 10class BeatmapDifficultyAttributes 11{ 12 public static function get(int $beatmapId, int $rulesetId, array $mods) 13 { 14 $response = (new Client(['base_uri' => $GLOBALS['cfg']['osu']['beatmaps']['difficulty_cache']['server_url']])) 15 ->request('POST', 'attributes', [ 16 'connect_timeout' => 1, 17 'json' => [ 18 'beatmap_id' => $beatmapId, 19 'mods' => $mods, 20 'ruleset_id' => $rulesetId, 21 ], 22 'timeout' => 5, 23 ]) 24 ->getBody() 25 ->getContents(); 26 27 return json_decode($response, true); 28 } 29}