Raised This Month: $ Target: $400
 0% 

SteamWorks http request returning weird characters


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
SomePanns
Senior Member
Join Date: Dec 2013
Old 07-25-2017 , 09:40   SteamWorks http request returning weird characters
Reply With Quote #1

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_EHTTPMethodGETs_URL);

    
SteamWorks_SetHTTPRequestNetworkActivityTimeout(handle5);
    
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;"sParamsizeof(sParam));
    
SteamWorks_SetHTTPCallbacks(handleHTTP_RequestComplete);
    
SteamWorks_SendHTTPRequest(handle);
}

public 
int HTTP_RequestComplete(Handle HTTPRequestbool bFailurebool bRequestSuccessfulEHTTPStatusCode eStatusCode)
{
    if(!
bRequestSuccessful) {
        
PrintToServer("Request failure");
    } else {
        
SteamWorks_GetHTTPResponseBodyData(HTTPRequestresponse_body4096);
        
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?

Last edited by SomePanns; 07-25-2017 at 09:42.
SomePanns 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 01:29.


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