在我将我的网站移到它之前,我目前正在玩这个库,但是我遇到了一个问题。一些 ID 在“SteamId::Create()”上给出 XML 错误——我的测试脚本:(使用 API 密钥)
<?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/>";*/
?>
我已经尝试过我的 ID,它在任何隐私设置下都可以正常工作,不会导致任何错误。
导致错误的 ID:
- 76561198082818051
- 76561198020696458
我唯一能想到的是它们是私人帐户,但是在我的另一个网站上,我能够很好地获取他们的游戏,并且我将帐户更改为私人帐户,它仍然可以正常加载。在加载 lib 之后,我确实有 set WebApi::setApiKey() 。
我确实需要能够从私人帐户中获取游戏。
错误:
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 链接有中断才能发布。