View Single Post
Matix8981
Junior Member
Join Date: Jun 2016
Old 03-24-2019 , 09:09   Re: REST in Pawn - Communicate with JSON REST APIs
Reply With Quote #57

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:
Code:
[[],[],[]]
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"postRequestCheckerCallback);
    
    
delete post;
}

void RequestCheckerCallback(HTTPResponse responseany 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"param1sizeof(param1));
    
    
PrintToServer("Param one %d"param1);

Matix8981 is offline