0

Hello i will get with 1 call a multiplie game-Achievmentlist from steam because i takes to many time for mulitplie calls.

usually i get the game list from the user and then i call for every game via foreach the xml file.

$url5 = http://steamcommunity.com/id/projacore/games/?xml=1';
print $url5;
$data5 = file_get_contents($url5);
$xml5 = simplexml_load_string($data5);
foreach ($xml5->games->children() as $item5){ 

$dasgame = htmlentities($item5->appID);

$url8 = 'http://api.steampowered.com/ISteamUserStats/GetSchemaForGame/v0002/?key=' . $steam_api . '&appid=' . $item5->appID . '&l=german&format=xml';
$data8 = file_get_contents($url8);
$xml8 = simplexml_load_string($data8);  


$url11 = 'http://api.steampowered.com/ISteamUserStats/GetPlayerAchievements/v0001/?appid=' . $dasgame . '&key=' . $steam_api . '&steamid=' . $item5->appID . '&l=german&format=xml';
$data11 = file_get_contents($url11);
$xml11 = simplexml_load_string($data11);

//and the rest of the code
}   

it takes so many time because when the user has 50 games it call 50 times data from steam.

now i will ask can i get multiplie Achievments with 1 call?

like this :

http://api.steampowered.com/ISteamUserStats/GetPlayerAchievements/v0001/?appid=240,400,10&key=' . $steam_api . '&steamid=' . $steamid64 . '&l=german&format=xml

thanks ahead

references:

ProJaCore
  • 42
  • 8

1 Answers1

0

No, you can not. The Steam API only allows you to query one game (appid) at a time.

To get around the 'slowness' that you experience, you may want to populate your web page via AJAX results. This way, the user sees the stats loading one at a time, as your server receives the results back.

A simple work flow:

  • User inputs their values as they currently do
  • New page loads. On this page, a div is created for each appid the user has a game for (this should be simple to find with a single API call)
  • The page fires off a separate ajax call for each appid
  • As the results are returned, the div associated with the returned results is populated

To the user, it should be obvious that you are retrieving the results, but still presenting them with some data before everything has completely returned.

Andy
  • 49,085
  • 60
  • 166
  • 233
  • I'm going to suggest looking at some JQuery tutorials then, focusing specifically on how to dynamically refresh a `div`. A walk through on stackoverflow is well beyond the bounds of what can by typed in an answer. It's a very broad topic depending on what you are doing. To answer your original question though - No, you have to query each game individually to get the achievement statistics. You are unable to query multiple games in a single call. – Andy Jun 06 '14 at 02:21