Raised This Month: $51 Target: $400
 12% 

REST in Pawn 1.3 - HTTP client for JSON REST APIs (Updated 2021/08/22)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
splinterz
Junior Member
Join Date: Sep 2011
Old 05-29-2020 , 04:45   Re: REST in Pawn - Communicate with JSON REST APIs
Reply With Quote #11

Quote:
Originally Posted by Matix8981 View Post
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);

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
splinterz is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:48.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode