SOLVED Check if http_post_string was successful?

O.Stogden

Member
Hi,

EDIT: This is solved, see the solution I found at the end of the post.

I was just wondering how you get if http_post_string successfully reached the server?

I have it working for http_get_file, but the following code never activates the code within the 'status=0' check, although the data is successfully uploaded.

Initiation event:
Code:
wrup=http_post_string("Private URL here",str)
wruploading=true
HTTP Async Event:
Code:
if ds_map_find_value(async_load, "id") == wrup
    {
        show_debug_message("WR UPLOAD ATTEMPT")
        var status = ds_map_find_value(async_load, "status")
    
        if status = 0
        {
        r_str = ds_map_find_value(async_load, "result");
        wruploaded=true
        wruploading=false
        show_debug_message("WR UPLOADED")
        }
    }
The WR Upload Attempt message appears, and the data goes to the server, but the WR UPLOADED message never displays, nor do the wruploaded and wruploading variables update. But the manual says the callback for 'status' will be 0 if the upload was successful, this doesn't appear to be the case for me at least.

I may be missing something obvious, so any help is appreciated.

Thanks!

EDIT: Solution appears to be to use the http_status and not the status part of the map.

The 200-299 range means "successful attempt", although it might be best to look for a specific success, this at least appears to return a reasonably accurate response if the server was contacted by the game.

HTTP Async code:
Code:
var found = ds_map_find_value(async_load, "http_status");
      
if found >= 200 && found <300
 
Last edited:
Top