ErikMinekus / sm-ripext

SourceMod REST in Pawn Extension
https://forums.alliedmods.net/showthread.php?t=298024
GNU General Public License v3.0
136 stars 38 forks source link

Post data #30

Closed oldmagic closed 4 years ago

oldmagic commented 4 years ago

Hello, i'm trying out this plugin for the first time and got it to work...but something seems to be wrong.

PHP file: $body = file_get_contents('php://input'); file_put_contents("post.json", $body, FILE_APPEND | LOCK_EX);

post.json file: 23ad458000^@{"headshot": true, "attackerblind": false, "thrusmoke": false, "assistedflash": false, "assist": 0, "penetrated": 0, "team_attacker": 3, "team_victim": 2, "weapon": "glock", "victim": "Paul", "attacker": "Colin"}

Now...why the hell does it post with this "23ad458000^@" ?

Plugin file: public void EventPlayerDeath(Event event, const char[] name, bool dontBroadcast) int victim = GetClientOfUserId(GetEventInt(event, "userid")); JSONObject Obj = new JSONObject(); Obj.SetString("victim", victim_name); httpClient = new HTTPClient("https://*****"); httpClient.Post("file.php", Obj, HTTPCallback);

void HTTPCallback(HTTPResponse response, any value) { if (response.Status != HTTPStatus_Created) { PrintToServer("Error 01"); return; } if (response.Data == null) { PrintToServer("Error 02"); return; } }

Thanks for any help on this!