Hello,
Sorry if I cannot explain now great detail, due to the fact as it is 3:43AM in the morning... Anyway, I want to integrate the steam API into my staff list. How would it be possible for me to set specific steam 64 Ids to get their steam nickname and avatar?
He is a random example of what would be changed, for example the avatar and a name will be on the steam API, and it is synced to that steam64.
[url]http://i.imgur.com/ZTycjLj.jpg[/url]
Assuming that you already know the steam users who are the staff, and thus know their Steam IDs, then it's just using the API to load the avatar, and pull the name.
Using the Steam Web API, you could use [URL="https://developer.valvesoftware.com/wiki/Steam_Web_API#GetPlayerSummaries_.28v0002.29"]this[/URL] in order to pull their avatar and nickname, and then use that info on your site.
Just make sure to get an API key [URL="http://steamcommunity.com/dev/apikey"]here[/URL]!
[editline]20th February 2016[/editline]
An even better way would be to store the info that you pull, for example their nickname and avatar, and the date that you pulled that info. Then, whenever the page is loaded for example, you could check if a certain amount of time has passed.
If said certain amount of time has passed, then allow an API call to grab the newer info.
If not, then just load it using the saved info.
[QUOTE=Nookyava;49782676]Assuming that you already know the steam users who are the staff, and thus know their Steam IDs, then it's just using the API to load the avatar, and pull the name.
Using the Steam Web API, you could use [URL="https://developer.valvesoftware.com/wiki/Steam_Web_API#GetPlayerSummaries_.28v0002.29"]this[/URL] in order to pull their avatar and nickname, and then use that info on your site.
Just make sure to get an API key [URL="http://steamcommunity.com/dev/apikey"]here[/URL]!
[editline]20th February 2016[/editline]
An even better way would be to store the info that you pull, for example their nickname and avatar, and the date that you pulled that info. Then, whenever the page is loaded for example, you could check if a certain amount of time has passed.
If said certain amount of time has passed, then allow an API call to grab the newer info.
If not, then just load it using the saved info.[/QUOTE]
Thank you, would you mind giving me an example just to check things through?
This is just a quick code sample I set up, so don't use it as an example of how it should PERFECTLY look, but it is a working example.
[code]<html>
<body>
<?php
$url = 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=xxxx&steamids=steamIDhere';
$jsonInfo = json_decode(file_get_contents($url), true);
$userAvatar = $jsonInfo['response']['players'][0]['avatarfull'];
$userNickname = $jsonInfo['response']['players'][0]['personaname'];
?>
<img src='<?php echo $userAvatar?>'/>
<br/>Name: <?php echo $userNickname?>
</body>
</html>[/code]
And [URL="http://jcwcreations.com/steam/example.php"]here[/URL] is an example page.
This is using PHP, so depending on your method the code may be different. This also doesn't showcase caching the info, but I figure you'll know how to do that.
How will I be able to move them next to each other, also would you mind tiding this up possibly?
[IMG]https://i.gyazo.com/663267223e7672ab6ef1d90d7ba328f6.png[/IMG]
[CODE] <?php
$url = 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=REMOVEDTEMP&steamids=76561197996924066';
$jsonInfo = json_decode(file_get_contents($url), true);
$userAvatar = $jsonInfo['response']['players'][0]['avatarfull'];
$userNickname = $jsonInfo['response']['players'][0]['personaname'];
?>
<img class="img-circle" src='<?php echo $userAvatar?>'>
<b><br/><?php echo $userNickname?></b>
<br/>Testing
</br>
<?php
$url = 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=REMOVEDTEMP&steamids=76561198164717153';
$jsonInfo = json_decode(file_get_contents($url), true);
$userAvatar = $jsonInfo['response']['players'][0]['avatarfull'];
$userNickname = $jsonInfo['response']['players'][0]['personaname'];
?>
<img class="img-circle" src='<?php echo $userAvatar?>'>
<b><br/><?php echo $userNickname?></b>
<br/>Testing 1 2 3[/CODE]
Sorry, you need to Log In to post a reply to this thread.