Hello!
I'm having a problem with my Post command. My server gets the post JSON data, but the plugin won't execute the function after. I'm calling DoSomething() function in OnPluginStart(). My code:
PHP Code:
public void DoSomething(){
PrintToServer("We are in DoSomething");
httpClient = new HTTPClient("http://ip.to.my.server");
JSONObject port = new JSONObject();
port.SetInt("port", iPort);
httpClient.Post("api/get_postfromcsgoserver", port, OnPortResponse);
PrintToServer("We are in DoSomething2");
delete port;
}
public void OnPortResponse(HTTPResponse response, any value){
PrintToServer("We are in OnPortResponse");
if(response.Status != HTTPStatus_Created) {
PrintToServer("!= HTTPStatus_Created");
return;
}
if (response.Data == null){
PrintToServer("response.data == null");
return;
}
}
The latter is just a part of the function. I don't get any compilation errors. It won't even print the "We are in OnPortResponse" to the server.
Does connection have to be https?
I get this from my server that the plugin tries to Post so it's working
[07/Nov/2017 14:28:09] "POST /api/get_postfromcsgoserver/ HTTP/1.1" 200 98
Thank you!