Hey Guys,
I’ve corona sdk since 2017 but, I’ve never done anything with the network request. I’m currently building a HTML 5 game that requires getting and updating information ona server and using it to determine the player’s progression.
For example, I create a variable called “openStages”, an integer which determines the number of stages opened at the level selection page, if the players opens two stages, then this variable is equal to (2), then I send this number to a server and next time the player opens the game, this variable is called from the server and used to determine the number of stages that should be opened.
I’ve gone through the network request API and I can’t seem to get it working. Here’s an example below. Please how do I get this working.
local function networkListener( event )
if ( event.isError ) then
print( "Network error: ", event.response )
else
print ( "RESPONSE: " … event.response )
end
end
local headers = {}
local body = “Hello”
local params = {}
params.headers = headers
headers[“Username”] = “soccerrtest”
headers[“Password”] = “htqry”
params.body = body
network.request( “http://45.58.119.26/cloudagents/api/gametest”, “POST”, networkListener, params )