I'm trying to get SteamWorks to read from json data using get requests, but it doesn't matter what URL I use to do it (and I've confirmed its valid json) it always returns weird characters.
PHP Code:
char response_body[4096];
public void SendRequest()
{
char s_URL[] = "http://httpbin.org/get";
char sParam[255] = "123";
Handle handle = SteamWorks_CreateHTTPRequest(k_EHTTPMethodGET, s_URL);
SteamWorks_SetHTTPRequestNetworkActivityTimeout(handle, 5);
SteamWorks_SetHTTPRequestHeaderValue(handle, "Pragma", "no-cache");
SteamWorks_SetHTTPRequestHeaderValue(handle, "Cache-Control", "no-cache");
SteamWorks_SetHTTPRequestGetOrPostParameter(handle, "action", sParam);
SteamWorks_SetHTTPRequestRawPostBody(handle, "application/json; charset=utf8;", sParam, sizeof(sParam));
SteamWorks_SetHTTPCallbacks(handle, HTTP_RequestComplete);
SteamWorks_SendHTTPRequest(handle);
}
public int HTTP_RequestComplete(Handle HTTPRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode)
{
if(!bRequestSuccessful) {
PrintToServer("Request failure");
} else {
SteamWorks_GetHTTPResponseBodyData(HTTPRequest, response_body, 4096);
PrintToServer("response_body = %s", response_body);
CloseHandle(HTTPRequest);
}
}
And the server always prints this "response_body = UëÕh" which doesn't really make any sense to me.
Leading to this error:
Code:
L 07/25/2017 - 15:32:28: Info (map "ctf_2fort") (file "errors_20170725.log")
L 07/25/2017 - 15:32:28: [SMJSON] Error in line 1, col 1: unable to decode byte 0x89 near 'U'
L 07/25/2017 - 15:32:28: [SM] Exception reported: Invalid <JSON Object> handle 0 (error 4)
Any ideas?