php Code:
header('Content-Type: text/plain');
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$decoded = json_decode(file_get_contents('php://input'));
$db = new PDO('mysql:host=localhost;dbname=###', '###', '###');
$prepared = $db->prepare('INSERT INTO ActiveServerData (GameName, GameId, GameOwner, GameMax, ServerId, ServerCurrent, ServerRunning, PendingCommand) VALUES (:Arg1, :Arg2, :Arg3, :Arg4, :Arg5, :Arg6, :Arg7, :Arg8)');
$prepared->execute((array) $decoded);
header('HTTP/1.1 200 OK');
print_r(json_encode($decoded));
} else {
header('HTTP/1.1 405 METHOD NOT ALLOWED');
echo '405 METHOD NOT ALLOWED';
}
Basically, I am attempting to send data using ROBLOXs PostAsync function, here is what I am sending;
local Connection = Server.Requires.WebAPI.PostData(Server.Game.GameName,Server.Game.GameID,Server,Server.Game.GameOwnerName,Server.Game.GamePlayerMax,Server.Server.ServerID,Server.ServerPlayerCount,"Admin","Nil")
warn(Connection)
This includes both strings, and number values. Below is the function that actually sends the data to the site.
WebAPI.PostData = function(Arg, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)
local http = game:GetService('HttpService')
local currentData = {
['Arg1'] = Arg;
['Arg2'] = Arg2;
['Arg3'] = Arg3;
['Arg4'] = Arg4;
['Arg5'] = Arg5;
['Arg6'] = Arg6;
['Arg7'] = Arg7;
['Arg8'] = Arg8;
}
local jsonData = http:JSONEncode(currentData)
local newData = http:PostAsync(
WebAPI.WebConnections.DeerSystems .. "/Secure/connect.php",
jsonData,
Enum.HttpContentType.ApplicationUrlEncoded
)
return newData
end
I get a return of the data, thats what should happen, however when I check the table nothing was inserted...