Here are two handy functions to use in getting the games and friend count for a steam profile.
To count the games owned amount for a steam profile use:
function game_count($steamid)
{
$data = json_decode(file_get_contents("https://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=YOURAPIKEY&steamid=" . $steamid . "&include_played_free_games=0&include_appinfo=1"));
$games_count = $data->response->game_count;
return $games_count;
}
echo game_count('754686934578698'); To count the friends a steam profile has use:
function friend_count($steamid)
{
$data = json_decode(file_get_contents("https://api.steampowered.com/ISteamUser/GetFriendList/v0001/?key=YOURAPIKEY&steamid=" . $steamid . "&relationship=friend"));
$friends_count = count($data->friendslist->friends);
return $friends_count;
}
echo friend_count('754678978080'); Dont forget to replace YOURAPIKEY with your steam apikey
A drained and empty Kennington reservoir images from a drone in early July 2024. The…
Merrimu Reservoir from drone. Click images to view larger.
Using FTP and PHP to get an array of file details such as size and…
Creating and using Laravel form requests to create cleaner code, separation and reusability for your…
Improving the default Laravel login and register views in such a simple manner but making…
Laravel validation for checking if a field value exists in the database. The validation rule…