我有一个Steam OpenID从2年开始登录我的网站,昨天我因为php返回403错误而遭到封锁。
screenshot of get_headers("https://steamcommunity.com/openid")
我没有更改任何内容(代码或其他内容),也没有滥用它(我摘录自网站上实施的徽标,并且我知道谁登录了),所以我知道为什么会出现403错误。
有人可以帮助我吗?为什么要实施封锁,或者向谁写封堵来撤销封锁?
代码
<?php
class SteamSignIn {
const STEAM_LOGIN = 'https://steamcommunity.com/openid/login';
public static function genUrl($returnTo = false, $useAmp = true) {
$returnTo = (!$returnTo) ? (!empty($_SERVER['HTTPS']) ? 'https' : 'http').'://agromex.wooqash.net/' : $returnTo;
$params = array(
'openid.ns' => 'http://specs.openid.net/auth/2.0',
'openid.mode' => 'checkid_setup',
'openid.return_to' => $returnTo,
'openid.realm' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http').'://agromex.wooqash.net/',
'openid.identity' => 'http://specs.openid.net/auth/2.0/identifier_select',
'openid.claimed_id' => 'http://specs.openid.net/auth/2.0/identifier_select',
);
$sep = ($useAmp) ? '&' : '&';
return self::STEAM_LOGIN . '?' . http_build_query($params, '', $sep);
}
public static function validate() {
$params = array(
'openid.assoc_handle' => $_GET['openid_assoc_handle'],
'openid.signed' => $_GET['openid_signed'],
'openid.sig' => $_GET['openid_sig'],
'openid.ns' => 'http://specs.openid.net/auth/2.0',
);
$signed = explode(',', $_GET['openid_signed']);
foreach($signed as $item)
{
$val = $_GET['openid_' . str_replace('.', '_', $item)];
$params['openid.' . $item] = get_magic_quotes_gpc() ? stripslashes($val) : $val;
}
$params['openid.mode'] = 'check_authentication';
$data = http_build_query($params);
$context = stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' =>
"Accept-language: en\r\n".
"Content-type: application/x-www-form-urlencoded\r\n" .
"Content-Length: " . strlen($data) . "\r\n",
'content' => $data,
),
));
$result = file_get_contents(self::STEAM_LOGIN, false, $context);
preg_match("#^https://steamcommunity.com/openid/id/([0-9]{17,25})#", $_GET['openid_claimed_id'], $matches);
$steamID64 = is_numeric($matches[1]) ? $matches[1] : 0;
return preg_match("#is_valid\s*:\s*true#i", $result) == 1 ? $steamID64 : '';
}
}
print_r(get_headers("https://steamcommunity.com/openid"));
$steamapi = SteamSignIn::validate();
echo "<hr />";
print_r($steamapi);
?>
结果
Array ( [0] => HTTP/1.0 403 Forbidden [1] => Server: AkamaiGHost [2] => Mime-Version: 1.0 [3] => Content-Type: text/html [4] => Content-Length: 269 [5] => Expires: Tue, 11 Sep 2018 16:33:56 GMT [6] => Date: Tue, 11 Sep 2018 16:33:56 GMT [7] => Connection: close)