This project is archived, no longer being maintained and probably full of security holes. I made this when I was younger as a learning experience so.. use at your own risk..
Using this php class I've made utilizes steams API so you can easly create a table of all your Steam games with logos and how much time you've spent playing of each game you own OR output the stats in the form of a multidimentional array you can output into your own styled page. You can also display a styled output of your current online status with your screen name and if you're playing a game, the name of that game. Each call requires the sID64 of the user to query which is sometimes hard to find so i've also included a small script that will convert a SteamID into the SteamID64 for use with making queries. Still working on making it more friendly for multiple users.
-
Go to http://steamcommunity.com/dev/apikey and get an api key if you don't already have one.
-
Open SteamWidget.class.php to line 6 and replace the pound symbols with your apikey.
define("APIKEY", "###########################");
-
you can also add a default profile to displace if a SteamID64 errors.
define("DEFAULTPROF", "76561198016593929");
-
You can added a fallback image for games without a logo, point to the image here.
define("NOIMAGE", "css/noimage.jpg");
- To call username for current online status use these lines
- It will echo out current online status (online, offline, away, in-game). If user is in game it will print out the game title as a link to get the game in the store.
- To call a prestyled table of a user's owned games
- This will query steams API to get a list of all games that a user owns with the game's logo, user's playtime data and even a link to the game in the Steam store.
$steamwidget = new SteamWidget();
echo $steamwidget->query_games_styled($usersSteamID64);
- To call a for all of a user's owned games to return as a multidimentional array
- array outputs: number, name, appid, playtimeAgo, gamelogourl (more to come possibly)
<?php $steamwidget = new SteamWidget();
$games = $steamwidget->query_games($sID64ToQuery);
foreach ($games as $number => $game): ?>
<tr>
<td><?php echo $game['number'];?></td>
<td><img src="<?php echo $game['gamelogourl'];?>" /></td>
<td><h4><a href="<?php echo 'http://store.steampowered.com/app/' . $game['appid'];?>"><?php echo $game['name'];?></a></h4></td>
<td><b><?php echo $game['playtimeAgo'];?></b></td>
</tr>
<?php endforeach; ?>
</table>
- Convert ID to 64ID
- To convert a steamID to a SteamID64 you can use this call, just send it the id or profile url
# | Logo | Games I Own | Playtime |
---|