嗨, 我正在CSGO赌博网站上工作。首先,该站点使用php,js,nodejs。您需要使用Steam登录,然后PHP代码将您的数据存储到变量中。登录后,一个js脚本将带有您的数据的请求发送到NodeJS服务器,该服务器向SteamAPI发出请求,并将结果发送回客户端。问题是,如果我刷新站点大约5次,它将返回一条消息(HTTP 429:请求过多)。 有以下代码:
PHP
require("../steamauth/steamauth.php");
require("../connect.php");
if(isset($_SESSION["steamid"])){
require ('../steamauth/userInfo.php');
$steamid = $steamprofile["steamid"];
$communityvisibilitystate = $steamprofile["communityvisibilitystate"];
$profilestate = $steamprofile["profilestate"];
$personaname = $steamprofile["personaname"];
$lastlogoff = $steamprofile["lastlogoff"];
$profileurl = $steamprofile["profileurl"];
$avatar = $steamprofile["avatar"];
$personastate = $steamprofile["personastate"];
$primaryclanid = $steamprofile["primaryclanid"];
$timecreated = $steamprofile["timecreated"];
}
Javascript
var name = "<?php if(isset($_SESSION["steamid"])){echo($personaname);}?>";
var avatar = "<?php if(isset($_SESSION["steamid"])){echo($avatar);}?>";
var steamid = "<?php if(isset($_SESSION["steamid"])){echo($steamid);}?>"
if(steamid){
console.log("logged in");
socket.emit("deposit_get_items", {steamid: steamid});
socket.on("deposit_get_items_finished", function(data){
var inventory = data.inventory;
}
}else{
console.log("not logged in");
}
NodeJS
socket.on("deposit_get_items", function(data){
var steamid = data.steamid;
community.getUserInventory(steamid, 730, 2, true, function(err, inventory){
if(err){
console.log("Error: (deposit_get_items) " + err)
}else{
socket.emit("deposit_get_items_finished", {inventory: inventory});
}
});