Steam Api 问题和 PHP 错误

Steam Api Issue and PHP error

大家好,我用 Steam 节点机器人在 Steam 上创建了一个网站,但有时在登录到 Steam 后,我的网站上方会出现这个。

我的开发人员告诉我是 Steam api 问题。是真的吗?

https://gyazo.com/3b72a35341e28761eaee2c8bcbfee7b0

https://steamstat.us

尝试在浏览器中访问 link(来自 file_get_contents),如果它抛出 503,则表明是 Steam 问题

使用类似的站点,is.steam.rip 您可以向该网站发出 api 调用,并允许用户根据 Steam 的状态查看您的网站。

首先打开保存为json字符串的api。对其进行解码并访问 SteamStatus

的 SteamCommunity 部分
$steam = file_get_contents('http://is.steam.rip/api/v1/?request=SteamStatus') or die("Is.Steam.RIP is currently offline");
$json_a = json_decode($steam);
$steamOnline=  $json_a->{'result'}->{'SteamStatus'}->{'services'}->{'SteamCommunity'};

如果你把它放在一个单独的文件中说 checkSteam.php 并将它包含在你的主页中你可以

include 'checkSteam.php';

并使用 if 语句:

if($steamOnline !== "offline") {
    // Show the users your website
}
else {
    // deny access since steam is down
}

我不知道这个 api 提供的所有状态,但它通常显示为 'delayed' 因此我只使用 !== "offline"

您可以在他们的主站点上找到更多 api here