Hey, folks. I'm stumped with a networking issue. I have code that builds a JSON document and uses a UrlLoader to post it to a PHP script on the web. In the player on Windows it works fine, but on Android the UrlLoader just triggers an Event.ERROR. Other UrlLoaders in the same app work fine, but they use GET rather than POST.
The code is pretty simple:
local json = (a simple json document in a string)
local path = "http://(my domain)/(a php script).php"
local headers =
{
["Content-Type"] = "application/json",
["Content-Length"] = string.len(json)
}
local loader = UrlLoader.new(path, UrlLoader.POST, headers, json)
Any ideas? Any different headers that might need to be set?
The reason for this, if anyone is curious: The app I'm preparing to release will get content on a subscription basis. The JSON post tells the server the user's subscription status (a set of receipts from IAB) and the server responds with a set of links to content packages the user is entitled to download.
Paul
Comments
I use this in Android, and it works just fine: