Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $steamid = $_GET["steamid"];
- $key = "5F96F7D2AE585388F1E5987557DDD6FA";
- if(strlen($steamid) == 17){ // Wanneer er gebruik wordt gemaakt van SteamID64
- $urlSteamStatsForGame = "http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=730&key=$key&steamid=$steamid";
- $urlSteamUserInfo = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=$key&steamids=$steamid";
- } elseif (strlen($steamid) < 17){ // Wanneer er gebruik wordt gemaakt van custom steam id
- $vanityurl = "http://api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/?key=$key&vanityurl=$steamid";
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $vanityurl);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($ch, CURLOPT_HTTPGET, true);
- $steamid64 = curl_exec($ch);
- curl_close($ch);
- $steamid64json = json_decode($steamid64, true);
- $doesexist = $steamid64json['response']['success']; // Checkt of profiel wel bestaat
- if($doesexist == 42){ // Profiel bestaat niet
- Alert("This profile doesn't exist, Error code 42");
- } elseif($doesexist == 1){ // Profiel bestaat
- $steamid64 = $steamid64json['response']['steamid'];
- $urlSteamStatsForGame = "http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=730&key=$key&steamid=$steamid64";
- $urlSteamUserInfo = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=$key&steamids=$steamid64";
- }
- }
- // Haal data op van URL
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $urlSteamUserInfo);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($ch, CURLOPT_HTTPGET, true);
- $SteamUserInfoResult = curl_exec($ch);
- curl_setopt($ch, CURLOPT_URL, $urlSteamStatsForGame);
- $SteamStatsForGameResult = curl_exec($ch);
- curl_close($ch);
- // Sla de informatie op in JSON vanuit arrays
- $jsonforuser = json_decode($SteamUserInfoResult, true);
- $jsonforgame = json_decode($SteamStatsForGameResult, true);
- if(empty($jsonforgame)){ // Profiel bestaat wel, maar heeft de game counterstrike niet in bezit/gespeeld
- Alert("This profile doesn't have the game counterstrike, Error code 43");
- }
- // Haal variablen op uit JSON
- $personname = $jsonforuser['response']['players'][0]['personaname'];
- $urlAvatar = $jsonforuser['response']['players'][0]['avatarfull'];
- $urlProfile = $jsonforuser['response']['players'][0]['profileurl'];
- $profilestate = $jsonforuser['response']['players'][0]['personastate'];
- $kills = $jsonforgame['playerstats']['stats'][0]['value'];
- $deaths = $jsonforgame['playerstats']['stats'][1]['value'];
- $kdr = $kills/$deaths;
- $headshot = $jsonforgame['playerstats']['stats'][25]['value'];
- $fired = $jsonforgame['playerstats']['stats'][46]['value'];
- $hit = $jsonforgame['playerstats']['stats'][47]['value'];
- $accuracy = $hit/$fired;
- $accuracypercentage = $accuracy * 100;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment