通过为我的网站设置我的自动捐赠系统,除了最后一页我得到了这个错误。这是通过 Steam 的 Garrys Mod 服务器。
错误:警告:file_get_contents(http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=xxxxxxxxxxxxxxxxxxx&steamids=xxxxxxxxxxxxx)[function.file-get-contents]:打开流失败:HTTP请求失败!HTTP/1.1 401 Unauthorized in /usr/www/angelgaming/public/multiple-rank/inc/page.verify.php 在线
验证.php 代码:
<?
include('apikey.php');
function toid($friendid) {
if (substr($friendid,-1)%2==0) $server=0; else $server=1;
$auth=bcsub($friendid,'76561197960265728');
$auth=bcsub($auth,$server);
$auth=bcdiv($auth,2);
return "STEAM_0:".$server.':'.$auth;
}
$string = file_get_contents('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=' . $API_KEY . 'steamids=' . $_COOKIE['communityid']);
$json_a = json_decode($string,true);
$steamname = $json_a['response']['players'][0]['personaname'];
$avatar64 = $json_a['response']['players'][0]['avatarfull'];
?>
<h4>Verify the information below before you proceed</h4>
<div id="verify">
<p><b><? echo $steamname; ?></b></p>
<p><img id="avatar" src="<? echo $avatar64; ?>" style="border-radius: 8px;" /></p>
<p><h6>Donation Amount: $<? echo RankPrice($_POST["rank"]) . CURRENCY;?></h6></p>
<br />
<p>
<form name="_xclick" action="https://www.paypal.com/nz/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<? echo PAYPAL_EMAIL; ?>">
<input type="hidden" name="currency_code" value="<? echo CURRENCY; ?>">
<input type="hidden" name="item_name" value="<? echo SERVER_NAME; ?> Donation (<? echo $steamname; ?>)">
<input type="hidden" name="item_number" value="<? echo toid($_COOKIE['communityid']) . '#' . $_POST["rank"]; ?>">
<input type="hidden" name="amount" value="<? echo RankPrice($_POST["rank"]); ?>">
<input role="button" class="btn btn-success" value="Donate" type="submit" alt="Donate to Envidious via PayPal">
<a href="" role="button" class="btn btn-danger">Go Back</a></form>
</div>