I'm currently playing around with this lib before i move my site over to it, But ive run into a problem. Some ID's give XML errors on "SteamId::Create()" -- My test script: (Using API key)
<?php
require 'core/include.php';
$id = SteamId::create('76561198006311959');
/*$stats = $id->getGameStats('49520');
$achievements = $stats->getAchievements();*/
echo $id->getNickname()."<br/>";
echo $id->getSteamId64()."<br/>";
echo $id->realName."<br/>";
echo $id->isOnline()."<br/>";
echo $id->getFullAvatarUrl()."<br/>";
$games = $id->getGames();
echo "<br/>";
foreach ($games as $g) {
echo $g->getName()." ----- ";
echo $id->getTotalPlaytime($g->getId())."<br/>";
}
echo "<br/>";
/*foreach ($achievements as $k) {
echo $k->getName()."<br />";
echo $k->description."<br /><br />";
}
echo "<br/>";*/
?>
I have tried my ID and it works fine under any privacy setting, doesnt cause any errors.
IDs that cause errors:
- 76561198082818051
- 76561198020696458
The only thing i can think of is that they are private accounts, But on my other site im able to fetch their games fine and i changed my account to private and it still loaded fine. I do have the set WebApi::setApiKey() just after the lib is loaded.
I do need to be able to fetch games from private accounts.
error:
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in D:\web\sites\gamersite\core\vendor\koraktor\steam-condenser\lib\steam\community\XMLData.php:32
Stack trace:
#0 D:\web\sites\gamersite\core\vendor\koraktor\steam-condenser\lib\steam\community\XMLData.php(32): SimpleXMLElement->__construct('http:// steamcom...', 0, true)
#1 D:\web\sites\gamersite\core\vendor\koraktor\steam-condenser\lib\steam\community\SteamId.php(337): XMLData->getData('http:// steamcom...')
#2 D:\web\sites\gamersite\core\vendor\koraktor\steam-condenser\lib\steam\community\SteamId.php(463): SteamId->fetchGames()
#3 D:\web\sites\gamersite\index.php(13): SteamId->getGames()
#4 {main}
Next exception 'SteamCondenserException' with message 'XML could not be parsed' in D:\web\sites\gamersite\core\vendor\koraktor\steam-condenser\lib\steam\community\XMLData.php:34
Stack trace:
#0 D:\web\sites\gamersite\core\vendor\koraktor\steam-condenser\lib\steam\community\SteamId.php(337): XMLData->getData('http:// steamcom...')
#1 D:\ in D:\web\sites\gamersite\core\vendor\koraktor\steam-condenser\lib\steam\community\XMLData.php on line 34
Steam links have breaks to be able to post.
It seems Valve has (once again) changed the XML endpoints. One of the profiles in question are private. In the past, the XML data for those profiles would be empty or return a meaningful error (in XML). Now, it seems, it will just redirect to the normal HTML website with the error message. Additionally, the HTTP status code is 200 (OK), so there's no indication that the data is erroneous.
Note: The XML API has been deprecated by Valve and Steam Condenser will switch completely to the Web API in the next major release.