Advertisement
Guest User

Untitled

a guest
Apr 19th, 2013
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php
  2.  
  3. $api_key = '.......'; //Steam API Key, Required to work
  4. $lines = file('parse.txt'); //reads in the file with the list of user numbers
  5. $game_id = 550; //Steam Game ID, 440 is TF2
  6. foreach ($lines as $usernumber) { //loops line by line
  7. $link = 'http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=' . $api_key . '&steamid=' . $usernumber . '&format=json';
  8. $json = file_get_contents($link); //Reads link (this ^)
  9. $data = json_decode($json);
  10. foreach ($data->response->games as $game) {
  11. if ($game->appid == $game_id) {
  12. echo 'Playtime for ', $usernumber, ' is ' . $game->playtime_forever."<br>";
  13. }
  14. }
  15. }
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement