Quote:
Originally Posted by Matix8981
I created simple debugging script in PHP for check if rest in pawn sending POST data to target HTTP but can't see any POST data in apache logs i see request from my csgo server.
Debugging script:
PHP Code:
<?php
file_put_contents("file.json", json_encode([$_REQUEST, $_GET, $_POST]));
?>
Output JSON file:
Plugin:
PHP Code:
void RequestChecker()
{
HTTPClient client = new HTTPClient("PAGE");
JSONObject post = new JSONObject();
post.SetString("type", "csgo");
post.SetString("param1", "string_first");
post.SetString("param2", "string_second");
client.Post("index.php", post, RequestCheckerCallback);
delete post;
}
void RequestCheckerCallback(HTTPResponse response, any value)
{
if (response.Status != HTTPStatus_Created)
{
PrintToServer("Error 01");
return;
}
if (response.Data == null)
{
PrintToServer("Error 02");
return;
}
JSONObject post = view_as<JSONObject>(response.Data);
char param1[128];
post.GetString("param1", param1, sizeof(param1));
PrintToServer("Param one %d", param1);
}
|
hi, did u fix this?
i got same error like this..
i got null response.Data and i got empty json on my web server..
i tried to use api tester and its working fine so it should be my sourcemod plugin