I’m trying to get a very simple file to run to load some JSON formatted data from a URL, but for some reason, I can’t get it to run on the Corona Simulator. The URL is valid and works fine when I enter it into a browser.
When I run the code below, I get the following error:
“ERROR: Error during request, code: -1002, details: unsupported URL”
local json = require "json" local dataURL = "http://masteringcoronasdk.com/bizapp/latest.php" local function newDataListener( event ) --Check for a connection if ( event.isError ) then print("Error - no connection") else local t = event.response t = json.decode(t) -- will create a table if #t \> 0 then print("Number of records: " .. tostring(#t)) else print("No new records found.") end end end network.request("dataURL", "GET", newDataListener)
Can anyone point me in the right direction here as to what I’m doing wrong?