在我将我的站点移到它之前,我正在玩这个库,但是我遇到了一个问题。一些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:
我唯一能想到的是,它们是私人帐户,但在我的另一个网站上,我可以获取他们的游戏罚款,我改变了我的帐户为私人,它仍然加载很好。在加载lib之后,我确实有一个集合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蒸汽链接有中断,可以张贴。
发布于 2013-08-25 20:03:57
似乎Valve (再次)更改了XML端点。其中一个个人资料是保密的。在过去,这些概要文件的XML数据将为空,或者返回一个有意义的错误(在XML中)。现在,它似乎,它将只是重定向到正常的HTML网站与错误信息。此外,HTTP状态代码为200 (OK),因此没有迹象表明数据是错误的。
注意: XML已被Valve拒绝,蒸汽凝汽器将在下一个主要版本中完全切换到Web。
https://stackoverflow.com/questions/18424545
复制相似问题